我刚刚编写了一个基本的JavaScript,带有一个加入会议的按钮。我使用了APP ID,密钥和用户名来生成带有-jar的令牌。在Web控制台上,它显示“ Connection FailedVIDYO_CONNECTORFAILREASON_ConnectionFailed onFailure”。对此表示感谢,谢谢!
下面是代码:
<html>
<head><title>Video Handler</title>
<meta http-equiv="content-type" content="text/html"; charset="utf-8"/>
</head>
<body>
<script>
var vidyoConnector;
function onVidyoClientLoaded(status){
console.log("VidyoClient load state"+status.state);
if(status.state== "READY"){
VC.CreateVidyoConnector({
viewId:"renderer",
viewStyle:"VIDYO_CONNECTORVIEWSTYLE_Default",
remoteParticipants:2,
logFileFilter:"error",
logFileName:"",
userData:""
}).then(function (vc){
console.log("Create Success");
}).catch(function(error){
});
}
}//end of vidyo client
function joinCall(){
vidyoConnector.Connect({
host:"prod.vidyo.io",
token:"cHJvdmlzaW9uAGF4YjM4ODIwQHVjbW8uZWR1QDdlNjE4Yi52aWR5by5pbwA2MzcwMzA5NjQ0NAAANDA0MjQ1MmE3N2RlYzA3ZGEwYmNjNTAzYWUzMTVhZWVjNzUzNmQ1NTBiMGU2NDQ3NTY0MzMxODI5ODRkMmU3YzQ0ODBhMTI3YzlkODE5Yjk2OGFjYjY4YWViNmRlOTcw",
displayName:"Arun",
resourceId:"IntranetEngineeringConference",
onSuccess:function(){
console.log("Connected to the Conference");
},
onFailure:function(reason){
console.error("Connection Failed");},//end of OnFailure
onDisconnected: function(reason){
console.log("disconnected -"+reason);
}//end of OnDisconnect
})
}//end of videocal function
</script>
<script src="https://static.vidyo.io/latest/javascript/VidyoClient/VidyoClient.js?onload=onVidyoClientLoaded"></script>
<h3>Hello Video Test</h3>
<button onclick="joinCall()">Join Conference</button>
<div id="renderer"></div>
答案 0 :(得分:0)
我相信问题是您没有设置vidyoConnector。 请尝试以下代码:
var vidyoConnector;
function onVidyoClientLoaded(status){
console.log("VidyoClient load state"+status.state);
if(status.state== "READY"){
VC.CreateVidyoConnector({
viewId:"renderer",
viewStyle:"VIDYO_CONNECTORVIEWSTYLE_Default",
remoteParticipants:2,
logFileFilter:"error",
logFileName:"",
userData:""
}).then(function (vc){
vidyoConnector = vc;
console.log("Create Success");
}).catch(function(error){
});
}
}//end of vidyo client
让我知道这是否有帮助。