Closed CovertError closed 6 months ago
If you are using import YSWebRTC from "ys-webrtc-sdk-ui"
, you can directly utilize the YSWebRTC module without the need to reassign it to window.YSWebRTC.。
npm install ys-webrtc-sdk-ui
first.
import { init } from 'ys-webrtc-sdk-ui';
const container = document.getElementById('container');
// Initialization
init(container, {
username: '1000',
secret: 'sdkshajgllliiaggskjhf',
pbxURL: 'https://192.168.1.1:8088'
}).then(data => {
// Obtain the exposed instances for additional business needs
const { phone, pbx, destroy, on } = data;
// ...
}).catch(err=>{
console.log(err)
})
BTW make sure your init config is correct,The account configuration in the sample code is not available。 @CovertError
I tried doing this replacing the information with our information and what i get is this and I'm using google chrome my project is running on TALL Stack and I'm using vite for asset https://vitejs.dev/ please let me know if there is something I'm missing
ys-webrtc-sdk-ui.js?v=a4c45421:24605 Uncaught Error: Automatic publicPath is not supported in this browser
at ys-webrtc-sdk-ui.js?v=a4c45421:24605:19
at ys-webrtc-sdk-ui.js?v=a4c45421:24607:10
at ys-webrtc-sdk-ui.js?v=a4c45421:24608:8
at ys-webrtc-sdk-ui.js?v=a4c45421:9:82
at node_modules/ys-webrtc-sdk-ui/lib/ys-webrtc-sdk-ui.js (ys-webrtc-sdk-ui.js?v=a4c45421:10:6)
at __require (chunk-34KZWS7D.js?v=a4c45421:5:50)
at ys-webrtc-sdk-ui.js?v=a4c45421:24612:16
import { init } from 'ys-webrtc-sdk-ui';
const container = document.getElementById('container');
// Initialization
init(container, {
username: '1000',
secret: 'sdkshajgllliiaggskjhf',
pbxURL: 'https://192.168.1.1:8088'
}).then(data => {
const { phone, pbx, destroy, on } = data;
console.log(data);
}).catch(err=>{
console.log(err)
});
i can create a demo project showing the issue if that helps
@SNH-48 @zengqq1997 @Yeastar-PBX thanks for everything
i can create a demo project showing the issue if that helps
yes, you can.
I tried doing this replacing the information with our information and what i get is this and I'm using google chrome my project is running on TALL Stack and I'm using vite for asset https://vitejs.dev/ please let me know if there is something I'm missing
ys-webrtc-sdk-ui.js?v=a4c45421:24605 Uncaught Error: Automatic publicPath is not supported in this browser at ys-webrtc-sdk-ui.js?v=a4c45421:24605:19 at ys-webrtc-sdk-ui.js?v=a4c45421:24607:10 at ys-webrtc-sdk-ui.js?v=a4c45421:24608:8 at ys-webrtc-sdk-ui.js?v=a4c45421:9:82 at node_modules/ys-webrtc-sdk-ui/lib/ys-webrtc-sdk-ui.js (ys-webrtc-sdk-ui.js?v=a4c45421:10:6) at __require (chunk-34KZWS7D.js?v=a4c45421:5:50) at ys-webrtc-sdk-ui.js?v=a4c45421:24612:16
import { init } from 'ys-webrtc-sdk-ui'; const container = document.getElementById('container'); // Initialization init(container, { username: '1000', secret: 'sdkshajgllliiaggskjhf', pbxURL: 'https://192.168.1.1:8088' }).then(data => { const { phone, pbx, destroy, on } = data; console.log(data); }).catch(err=>{ console.log(err) });
It seems your index.html use the
<script src="%publicPath%/ys-webrtc-sdk-ui.js"></script>
to require sdk-ui ?
https://github.com/SNH-48/vue-with-ys-webrtc-sdk-ui-exmaple
here repo for you, you can see the HelloWorld.vue
component how it work. @CovertError
I'm not sure if this works with you but this what i did
`
// Obtain the exposed instances for additional business needs const { phone, pbx, destroy, on } = data; // ... }).catch(err=>{ console.log(err) }) ` because i use vite so im doing this on my app.js
import YSWebRTC from "ys-webrtc-sdk-ui"; window.YSWebRTC = YSWebRTC;
let me know if I'm missing something