From a7025c41f61d91bd93bedf1652af2ff511fe6f9d Mon Sep 17 00:00:00 2001 From: paweldomas Date: Fri, 16 Jun 2017 09:24:59 -0500 Subject: [PATCH] fix(conference): do not go back to video Do not go back to video from screen sharing if there was no video stream at the time when screen sharing was being started. --- conference.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/conference.js b/conference.js index 248c859c1..5455ee6ce 100644 --- a/conference.js +++ b/conference.js @@ -1140,6 +1140,8 @@ export default { let externalInstallation = false; if (shareScreen) { + const didHaveVideo = Boolean(this.localVideo); + return createLocalTracks({ desktopSharingSources: options.desktopSharingSources, devices: ['desktop'], @@ -1170,18 +1172,18 @@ export default { // close external installation dialog on success. if(externalInstallation) $.prompt.close(); - stream.on( - TrackEvents.LOCAL_TRACK_STOPPED, - () => { - // if stream was stopped during screensharing session - // then we should switch to video - // otherwise we stopped it because we already switched - // to video, so nothing to do here - if (this.isSharingScreen) { - this.toggleScreenSharing(false); + if (didHaveVideo) { + stream.on( + TrackEvents.LOCAL_TRACK_STOPPED, + () => { + // If the stream was stopped during screen sharing + // session then we should switch back to video. + if (this.isSharingScreen) { + this.toggleScreenSharing(false); + } } - } - ); + ); + } return this.useVideoStream(stream); }).then(() => { this.videoSwitchInProgress = false;