Browse Source

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.
master
paweldomas 8 years ago
parent
commit
a7025c41f6
1 changed files with 13 additions and 11 deletions
  1. 13
    11
      conference.js

+ 13
- 11
conference.js View File

1140
         let externalInstallation = false;
1140
         let externalInstallation = false;
1141
 
1141
 
1142
         if (shareScreen) {
1142
         if (shareScreen) {
1143
+            const didHaveVideo = Boolean(this.localVideo);
1144
+
1143
             return createLocalTracks({
1145
             return createLocalTracks({
1144
                 desktopSharingSources: options.desktopSharingSources,
1146
                 desktopSharingSources: options.desktopSharingSources,
1145
                 devices: ['desktop'],
1147
                 devices: ['desktop'],
1170
                 // close external installation dialog on success.
1172
                 // close external installation dialog on success.
1171
                 if(externalInstallation)
1173
                 if(externalInstallation)
1172
                     $.prompt.close();
1174
                     $.prompt.close();
1173
-                stream.on(
1174
-                    TrackEvents.LOCAL_TRACK_STOPPED,
1175
-                    () => {
1176
-                        // if stream was stopped during screensharing session
1177
-                        // then we should switch to video
1178
-                        // otherwise we stopped it because we already switched
1179
-                        // to video, so nothing to do here
1180
-                        if (this.isSharingScreen) {
1181
-                            this.toggleScreenSharing(false);
1175
+                if (didHaveVideo) {
1176
+                    stream.on(
1177
+                        TrackEvents.LOCAL_TRACK_STOPPED,
1178
+                        () => {
1179
+                            // If the stream was stopped during screen sharing
1180
+                            // session then we should switch back to video.
1181
+                            if (this.isSharingScreen) {
1182
+                                this.toggleScreenSharing(false);
1183
+                            }
1182
                         }
1184
                         }
1183
-                    }
1184
-                );
1185
+                    );
1186
+                }
1185
                 return this.useVideoStream(stream);
1187
                 return this.useVideoStream(stream);
1186
             }).then(() => {
1188
             }).then(() => {
1187
                 this.videoSwitchInProgress = false;
1189
                 this.videoSwitchInProgress = false;

Loading…
Cancel
Save