Capture several errors and crashes in client and bbb-webrtc-sfu
This commit is contained in:
parent
4e2833aa07
commit
a370285f0b
@ -18,10 +18,6 @@ export default class VideoDock extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
videos: {},
|
||||
};
|
||||
|
||||
this.state = {
|
||||
// Set a valid kurento application server socket in the settings
|
||||
ws: new ReconnectingWebSocket(Meteor.settings.public.kurento.wsUrl),
|
||||
@ -31,6 +27,7 @@ export default class VideoDock extends Component {
|
||||
reconnectList: [],
|
||||
sharedCameraTimeout: null,
|
||||
subscribedCamerasTimeouts: [],
|
||||
videos: {},
|
||||
};
|
||||
|
||||
window.ws = this.state.ws;
|
||||
@ -70,9 +67,12 @@ export default class VideoDock extends Component {
|
||||
for (i in this.state.reconnectList) {
|
||||
const id = this.state.reconnectList[i];
|
||||
|
||||
// TODO: base this on BBB API users instead of using memory
|
||||
if (id != this.state.myId) {
|
||||
log('debug', ` [camera] Trying to reconnect camera ${id}`);
|
||||
this.start(id, false, this.refs.videoInput);
|
||||
setTimeout(() => {
|
||||
log('debug', ` [camera] Trying to reconnect camera ${id}`);
|
||||
this.start(id, false, this.refs.videoInput);
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,6 +133,12 @@ export default class VideoDock extends Component {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
// If we are ever in a position where iceQueue is not defined by this point
|
||||
if (typeof webRtcPeer.iceQueue === 'undefined') {
|
||||
webRtcPeer.iceQueue = [];
|
||||
}
|
||||
|
||||
webRtcPeer.iceQueue.push(parsedMessage.candidate);
|
||||
}
|
||||
} else {
|
||||
@ -248,8 +254,8 @@ export default class VideoDock extends Component {
|
||||
}
|
||||
|
||||
disconnected(id) {
|
||||
if (this.state.sharedWebcam && this.state.myId == id) {
|
||||
log('debug', ' [camera] Disconnected, will try re-share webcam later.');
|
||||
if (this.state.sharedWebcam) {
|
||||
log('debug', ' [camera] Webcam disconnected, will try re-share webcam later.');
|
||||
this.setState({ reconnectWebcam: true });
|
||||
} else {
|
||||
const reconnectList = this.state.reconnectList;
|
||||
@ -314,10 +320,9 @@ export default class VideoDock extends Component {
|
||||
log('info', 'No WebRTC peer to stop (not an error)');
|
||||
}
|
||||
|
||||
if (id == this.state.myId && this.state.sharedWebcam) {
|
||||
if (this.state.sharedWebcam) {
|
||||
this.state.sharedWebcam.dispose();
|
||||
this.state.sharedWebcam = null;
|
||||
this.state.myId = null;
|
||||
} else {
|
||||
log('info', 'No shared camera WebRTC peer to stop (not an error)');
|
||||
}
|
||||
@ -327,7 +332,12 @@ export default class VideoDock extends Component {
|
||||
const { users } = this.props;
|
||||
const id = users[0].userId;
|
||||
|
||||
this.start(id, true, this.refs.videoInput);
|
||||
if (this.connectedToMediaServer()) {
|
||||
this.start(id, true, this.refs.videoInput);
|
||||
} else {
|
||||
log("error", "Not connected to media server BRA");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unshareWebcam() {
|
||||
@ -389,6 +399,7 @@ export default class VideoDock extends Component {
|
||||
|
||||
handlePlayStop(message) {
|
||||
log('info', 'Handle play stop <--------------------');
|
||||
log('error', message);
|
||||
|
||||
this.stop(message.cameraId);
|
||||
}
|
||||
@ -440,6 +451,11 @@ export default class VideoDock extends Component {
|
||||
this.stop(users[i].userId);
|
||||
}
|
||||
|
||||
if (!nextUsers[i].has_stream) {
|
||||
console.log(" DESTROYING ----------------------- " + users[i].userId);
|
||||
this.destroyVideoTag(users[i].userId);
|
||||
}
|
||||
|
||||
suc = suc || true;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,19 @@ module.exports = class RedisWrapper extends EventEmitter {
|
||||
|
||||
console.log(" [RedisWrapper] Trying to subscribe to redis channel");
|
||||
|
||||
this.redisCli.on("connect", () => {
|
||||
// console.log(" [RedisWrapper] Connected to Redis Server.");
|
||||
// DO SOMETHING
|
||||
});
|
||||
|
||||
this.redisCli.on("error", (e) => {
|
||||
console.error(" [RedisWrapper] " + e);
|
||||
});
|
||||
|
||||
this.redisCli.on("reconnecting", (e) => {
|
||||
// DO SOMETHING
|
||||
});
|
||||
|
||||
this.redisCli.on("psubscribe", (channel, count) => {
|
||||
console.log(" [RedisWrapper] Successfully subscribed to pattern [" + channel + "]");
|
||||
});
|
||||
@ -102,9 +115,9 @@ module.exports = class RedisWrapper extends EventEmitter {
|
||||
}
|
||||
|
||||
static _redisRetry (options) {
|
||||
if (options.error && options.error.code === 'ECONNREFUSED') {
|
||||
return new Error('The server refused the connection');
|
||||
}
|
||||
// if (options.error && options.error.code === 'ECONNREFUSED') {
|
||||
// return new Error('The server refused the connection');
|
||||
// }
|
||||
if (options.total_retry_time > RedisWrapper._retryThreshold) {
|
||||
return new Error('Retry time exhausted');
|
||||
}
|
||||
|
@ -196,6 +196,7 @@ module.exports = class MediaController {
|
||||
|
||||
async subscribe (userId, sourceId, type, params) {
|
||||
console.log(" [mcs] subscribe");
|
||||
|
||||
let session;
|
||||
// TODO handle mediaType
|
||||
let mediaType = params.mediaType;
|
||||
|
@ -161,6 +161,11 @@ module.exports = class ScreenshareManager {
|
||||
|
||||
_stopSession(sessionId) {
|
||||
console.log(' [>] Stopping session ' + sessionId);
|
||||
|
||||
if (typeof this._screenshareSessions === 'undefined' || typeof sessionId === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
let session = this._screenshareSessions[sessionId];
|
||||
if(typeof session !== 'undefined' && typeof session._stop === 'function') {
|
||||
session._stop();
|
||||
@ -171,6 +176,11 @@ module.exports = class ScreenshareManager {
|
||||
|
||||
stopAll() {
|
||||
console.log('\n [x] Stopping everything! ');
|
||||
|
||||
if (typeof this._screenshareSessions === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
let sessionIds = Object.keys(this._screenshareSessions);
|
||||
|
||||
for (let i = 0; i < sessionIds.length; i++) {
|
||||
|
@ -108,8 +108,13 @@ var _onMessage = function (_message) {
|
||||
}
|
||||
};
|
||||
|
||||
let stopSession = function(sessionId) {
|
||||
let stopSession = function(sessionId, videoId) {
|
||||
console.log(' [VideoManager/x] Stopping session ' + sessionId);
|
||||
|
||||
if (sessions == null || sessionId == null || sessions[sessionId] == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let videoIds = Object.keys(sessions[sessionId]);
|
||||
|
||||
for (var i = 0; i < videoIds.length; i++) {
|
||||
@ -119,10 +124,17 @@ let stopSession = function(sessionId) {
|
||||
}
|
||||
|
||||
sessions[sessionId] = null;
|
||||
|
||||
delete sessions[sessionId];
|
||||
}
|
||||
|
||||
let stopAll = function() {
|
||||
console.log(' [Video/x] Stopping everything! ');
|
||||
|
||||
if (sessions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let sessionIds = Object.keys(sessions);
|
||||
|
||||
for (var i = 0; i < sessionIds.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user