尝试从同一系统拨打2个电话时出现Opentok错误

时间:2015-05-22 11:39:44

标签: webrtc opentok

当我们尝试从同一系统(桌面/移动设备)拨打多个电话时,opentok正在给我们一个错误。错误是

  

OT.Publisher.onStreamAvailableError SourceUnavailableError:获取用户媒体时出现未知错误

获取用户媒体时

1500 Unknown错误

OT.exception :: title:无法发布(1500)msg:获取用户媒体时出现未知错误

SourceUnavailableError:无法分配视频源

我们使用的代码是:

var apiKey = 'opentok apikey';
var sessionId = 'opentok session id';
var token = 'opentok token';
var session = OT.initSession(apiKey, sessionId);
session.addEventListener('sessionConnected', sessionConnectedHandler);
session.addEventListener('sessionDisconnected', sessionDisconnectedHandler);
session.addEventListener('connectionCreated', connectionCreatedHandler);
session.addEventListener('connectionDestroyed', connectionDestroyedHandler);
session.addEventListener('streamCreated', streamCreatedHandler);
session.addEventListener('streamDestroyed', streamDestroyedHandler);
session.addEventListener('signal', signalHandler);
var parentDiv = document.getElementById('myCamera');
var publisherDiv = document.createElement('div'); // Create a div for the publisher to replace
var publisherProperties = {height: 100, width: 100};// {width:132, height:100, left: 10, top: -95};
publisherProperties.name = 'Guest';
publisherProperties.style={buttonDisplayMode: 'off'};
publisherDiv.setAttribute('id', 'opentok_publisher');
parentDiv.appendChild(publisherDiv);
var publisher = OT.initPublisher(publisherDiv.id, publisherProperties);

session.connect(token, function(error) {
session.publish(publisher);  
});
session.on('streamCreated', function(event) {

session.subscribe(event.stream,"subscribers",
                               {width:"100%", height:"100%"})
});
function sessionConnectedHandler(event) {
}
function sessionDisconnectedHandler(event) {
}
function connectionCreatedHandler(event) {

}
function connectionDestroyedHandler(event) {
}
function streamCreatedHandler(event) {
}
function streamDestroyedHandler(event) {
}
function signalHandler(event) {
}

1 个答案:

答案 0 :(得分:1)

我可以在Chrome窗口和Firefox窗口中打开meet.tokbox.com,并成功与自己进行完整视频和音频对话,首先 - 您确定当前的实施是否正确?

但是要回答您的实际问题,没有API可以跨浏览器检测唯一用户。但是,您可以根据用户名门户为人员分配唯一的令牌,以便标记用户。