在Firefox视频聊天工作正常但Google Chrome中未激活媒体设备。 代码:
local.php
<div id="remote" style="display:inline-block;"></div>
<div id="local" style="display:inline-block;"></div>
<script src="https://media.twiliocdn.com/sdk/js/common/v0.1/twilio-common.min.js"></script>
<script src="https://media.twiliocdn.com/sdk/js/conversations/v0.13/twilio-conversations.min.js"></script>
<script src="inviteAccepted1.js"></script>
<script>
var accessToken = "Token from twilio";
var accessManager = Twilio.AccessManager(accessToken);
var client = Twilio.Conversations.Client(accessManager);
// Begin listening for invites to Twilio Video conversations.
client.listen().then(function() {
client.on('invite', function(invite) {
invite.accept().then(onInviteAccepted);
});
});
</script>
remote.php
<div id="remote" style="display:inline-block;"></div>
<div id="local" style="display:inline-block;"></div>
<script src="https://media.twiliocdn.com/sdk/js/common/v0.1/twilio-common.min.js"></script>
<script src="https://media.twiliocdn.com/sdk/js/conversations/v0.13/twilio-conversations.min.js"></script>
<script src="inviteAccepted1.js"></script>
<script>
var otheruser = "local username";
var accessToken = "Token from twilio";
var accessManager = new Twilio.AccessManager(accessToken);
var client = new Twilio.Conversations.Client(accessManager);
client.inviteToConversation(otheruser).then(onInviteAccepted);
</script>
inviteAccepted1.js
function conversationStarted(conversation) {
// Here is where you add your own custom functionality.
console.log('The conversation has started.');
}
function onInviteAccepted(conversation) {
conversation.localMedia.attach('#local');
conversation.on('participantConnected', function(participant) {
participant.media.attach('#remote');
conversationStarted(conversation);
});
}
关注https://www.twilio.com/blog/2016/03/chrome-vs-firefox-webrtc-stats-api-with-twilio-video.html文章,但 conversation._dialogue未定义错误。
答案 0 :(得分:0)
Twilio开发者传道者在这里。
你提到的The blog post已经过时了我害怕。 Twilio Video(在撰写本文时)处于测试阶段,API已更新为使用新的房间模型。查看getting started article on Twilio Video here。
在回答你的问题时,the blog post本身从未提及财产conversation._dialogue
。它指的是conversation._dialogs
。所以也许这就是你所缺少的。