RTCMulticonnection room join keeps throwing error : Session-Descriptions not found. Rechecking
RTCMulticonnection room join keeps throwing error : Session-Descriptions not found. Rechecking
我正在使用 RTCMulticonnection MultiRTC 脚本来捕获和流式传输多个用户摄像头。
我想,如果任何用户刷新页面,即使我添加了页面 unload
事件
,会话也会在后台保持活动状态
window.onbeforeunload = function() {
rtcMultiConnection.close();
};
我的问题是刷新后加入房间时不断抛出 error/warning 消息 找不到会话描述。正在复核...
为什么找不到会话描述?我检查了 RTCMulticonnection js,这个错误是从函数下面抛出的。
function joinSession(session, joinAs) {
if (isString(session)) {
connection.skipOnNewSession = true;
}
console.log(session);
console.log(joinAs);
if (!rtcMultiSession) {
log('Signaling channel is not ready. Connecting...');
// connect with signaling channel
initRTCMultiSession(function() {
log('Signaling channel is connected. Joining the session again...');
setTimeout(function() {
joinSession(session, joinAs);
}, 1000);
});
return;
}
// connection.join('sessionid');
if (isString(session)) {
if (connection.sessionDescriptions[session]) {
session = connection.sessionDescriptions[session];
} else
return setTimeout(function() {
log('Session-Descriptions not found. Rechecking..');
joinSession(session, joinAs);
}, 1000);
}
// connection.join('sessionid', { audio: true });
if (joinAs) {
return captureUserMedia(function() {
session.oneway = true;
joinSession(session);
}, joinAs);
}
if (!session || !session.userid || !session.sessionid) {
error('missing arguments', arguments);
var error = 'Invalid data passed over "connection.join" method.';
connection.onstatechange({
userid: 'browser',
extra: {},
name: 'Unexpected data detected.',
reason: error
});
throw error;
}
if (!connection.dontOverrideSession) {
connection.session = session.session;
}
var extra = connection.extra || session.extra || {};
// todo: need to verify that if-block statement works as expected.
// expectations: if it is oneway streaming; or if it is data-only connection
// then, it shouldn't capture user-media on participant's side.
if (session.oneway || isData(session)) {
rtcMultiSession.joinSession(session, extra);
} else {
captureUserMedia(function() {
rtcMultiSession.joinSession(session, extra);
});
}
}
使用 RTCMulticonnection version v3, also used socket.io 而不是 WebSocket 升级了我的应用程序,之前我使用的是 WebSocket。
我正在使用 RTCMulticonnection MultiRTC 脚本来捕获和流式传输多个用户摄像头。
我想,如果任何用户刷新页面,即使我添加了页面 unload
事件
window.onbeforeunload = function() {
rtcMultiConnection.close();
};
我的问题是刷新后加入房间时不断抛出 error/warning 消息 找不到会话描述。正在复核...
为什么找不到会话描述?我检查了 RTCMulticonnection js,这个错误是从函数下面抛出的。
function joinSession(session, joinAs) {
if (isString(session)) {
connection.skipOnNewSession = true;
}
console.log(session);
console.log(joinAs);
if (!rtcMultiSession) {
log('Signaling channel is not ready. Connecting...');
// connect with signaling channel
initRTCMultiSession(function() {
log('Signaling channel is connected. Joining the session again...');
setTimeout(function() {
joinSession(session, joinAs);
}, 1000);
});
return;
}
// connection.join('sessionid');
if (isString(session)) {
if (connection.sessionDescriptions[session]) {
session = connection.sessionDescriptions[session];
} else
return setTimeout(function() {
log('Session-Descriptions not found. Rechecking..');
joinSession(session, joinAs);
}, 1000);
}
// connection.join('sessionid', { audio: true });
if (joinAs) {
return captureUserMedia(function() {
session.oneway = true;
joinSession(session);
}, joinAs);
}
if (!session || !session.userid || !session.sessionid) {
error('missing arguments', arguments);
var error = 'Invalid data passed over "connection.join" method.';
connection.onstatechange({
userid: 'browser',
extra: {},
name: 'Unexpected data detected.',
reason: error
});
throw error;
}
if (!connection.dontOverrideSession) {
connection.session = session.session;
}
var extra = connection.extra || session.extra || {};
// todo: need to verify that if-block statement works as expected.
// expectations: if it is oneway streaming; or if it is data-only connection
// then, it shouldn't capture user-media on participant's side.
if (session.oneway || isData(session)) {
rtcMultiSession.joinSession(session, extra);
} else {
captureUserMedia(function() {
rtcMultiSession.joinSession(session, extra);
});
}
}
使用 RTCMulticonnection version v3, also used socket.io 而不是 WebSocket 升级了我的应用程序,之前我使用的是 WebSocket。