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.
This commit is contained in:
paweldomas 2017-06-16 09:24:59 -05:00 committed by virtuacoplenny
parent d84ab20a47
commit a7025c41f6
1 changed files with 13 additions and 11 deletions

View File

@ -1140,6 +1140,8 @@ export default {
let externalInstallation = false; let externalInstallation = false;
if (shareScreen) { if (shareScreen) {
const didHaveVideo = Boolean(this.localVideo);
return createLocalTracks({ return createLocalTracks({
desktopSharingSources: options.desktopSharingSources, desktopSharingSources: options.desktopSharingSources,
devices: ['desktop'], devices: ['desktop'],
@ -1170,18 +1172,18 @@ export default {
// close external installation dialog on success. // close external installation dialog on success.
if(externalInstallation) if(externalInstallation)
$.prompt.close(); $.prompt.close();
if (didHaveVideo) {
stream.on( stream.on(
TrackEvents.LOCAL_TRACK_STOPPED, TrackEvents.LOCAL_TRACK_STOPPED,
() => { () => {
// if stream was stopped during screensharing session // If the stream was stopped during screen sharing
// then we should switch to video // session then we should switch back to video.
// otherwise we stopped it because we already switched
// to video, so nothing to do here
if (this.isSharingScreen) { if (this.isSharingScreen) {
this.toggleScreenSharing(false); this.toggleScreenSharing(false);
} }
} }
); );
}
return this.useVideoStream(stream); return this.useVideoStream(stream);
}).then(() => { }).then(() => {
this.videoSwitchInProgress = false; this.videoSwitchInProgress = false;