在php应用程序和接收器中集成的vLine视频聊天不会接到任何电话

时间:2013-11-28 04:43:21

标签: javascript php codeigniter webrtc vline

我已经在本地成功测试了vline-node示例但是当我将我的代码上传到服务器并且我的用户能够呼叫另一个人但是在另一端时用户无法接收任何呼叫,因为没有呼叫接收。我正在使用我从GitHub下载的脚本。 vline示例中使用的链接

https://github.com/vline/vline-php-example

如果你使用它,请帮助我。感谢

  var client, vlinesession,
    authToken = '<?php echo $vline->getJWT() ?>',
    serviceId = '<?php echo $vline->getServiceID() ?>',
    profile = {"displayName": '<?php echo $vline->getUserDisplayName() ?>', "id": '<?php echo $vline->getUserID() ?>'};

  // Create vLine client  
  window.vlineClient = client = vline.Client.create({"serviceId": serviceId, "ui": true});
  // Add login event handler
  client.on('login', onLogin);
  // Do login


  client.login(serviceId, profile, authToken);


  function onLogin(event) {
    vlinesession = event.target;
    // Find and init call buttons and init them
    $(".callbutton").each(function(index, element) {
       initCallButton($(this)); 
    });
  }

  // add event handlers for call button
  function initCallButton(button) {
    var userId = button.attr('data-userid');

    // fetch person object associated with username
    vlinesession.getPerson(userId).done(function(person) {
      // update button state with presence
      function onPresenceChange() {
        if(person.getPresenceState() == 'online'){
            button.removeClass().addClass('active');
        }else{
            button.removeClass().addClass('disabled');
        }
        button.attr('data-presence', person.getPresenceState());
      }

      // set current presence
      onPresenceChange();

      // handle presence changes
      person.on('change:presenceState', onPresenceChange);

      // start a call when button is clicked
      button.click(function() {
              if (person.getId() == vlinesession.getLocalPersonId()) {
            alert('You cannot call yourself. Login as another user in an incognito window');
            return;
              }
          if(button.hasClass('active'))
            person.startMedia();
      });
    });

  }

  return client;
})();

$(window).unload(function() {
  vlineClient.logout();
});
</script>`

0 个答案:

没有答案