0

我刚刚编写了一个带有加入会议按钮的基本 JavaScript。我使用了 APP ID、Key 和用户名来生成带有 -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>

4

1 回答 1

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

让我知道这是否有帮助。

于 2019-01-08T15:12:17.687 回答