Browse Source

Merge pull request #545 from damencho/fix-video-switching-on-hide-container

Fix video switching on hide container
j8
yanas 9 years ago
parent
commit
4ffafbe9a8

+ 1
- 1
modules/UI/shared_video/SharedVideo.js View File

392
 
392
 
393
     // Make sure that the large video is updated if are removing its
393
     // Make sure that the large video is updated if are removing its
394
     // corresponding small video.
394
     // corresponding small video.
395
-    this.VideoLayout.updateRemovedVideo(this.id);
395
+    this.VideoLayout.updateAfterThumbRemoved(this.id);
396
 
396
 
397
     // Remove whole container
397
     // Remove whole container
398
     if (this.container.parentNode) {
398
     if (this.container.parentNode) {

+ 4
- 1
modules/UI/videolayout/LocalVideo.js View File

191
 
191
 
192
     let endedHandler = () => {
192
     let endedHandler = () => {
193
         localVideoContainer.removeChild(localVideo);
193
         localVideoContainer.removeChild(localVideo);
194
-        this.VideoLayout.updateRemovedVideo(this.id);
194
+        // when removing only the video element and we are on stage
195
+        // update the stage
196
+        if(this.VideoLayout.isCurrentlyOnLarge(this.id))
197
+            this.VideoLayout.updateLargeVideo(this.id);
195
         stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
198
         stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
196
     };
199
     };
197
     stream.on(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
200
     stream.on(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);

+ 5
- 3
modules/UI/videolayout/RemoteVideo.js View File

156
     console.info((isVideo ? "Video" : "Audio") +
156
     console.info((isVideo ? "Video" : "Audio") +
157
                  " removed " + this.id, select);
157
                  " removed " + this.id, select);
158
 
158
 
159
-    if (isVideo)
160
-        this.VideoLayout.updateRemovedVideo(this.id);
159
+    // when removing only the video element and we are on stage
160
+    // update the stage
161
+    if (isVideo && this.VideoLayout.isCurrentlyOnLarge(this.id))
162
+        this.VideoLayout.updateLargeVideo(this.id);
161
 };
163
 };
162
 
164
 
163
 /**
165
 /**
168
     this.removeConnectionIndicator();
170
     this.removeConnectionIndicator();
169
     // Make sure that the large video is updated if are removing its
171
     // Make sure that the large video is updated if are removing its
170
     // corresponding small video.
172
     // corresponding small video.
171
-    this.VideoLayout.updateRemovedVideo(this.id);
173
+    this.VideoLayout.updateAfterThumbRemoved(this.id);
172
     // Remove whole container
174
     // Remove whole container
173
     if (this.container.parentNode) {
175
     if (this.container.parentNode) {
174
         this.container.parentNode.removeChild(this.container);
176
         this.container.parentNode.removeChild(this.container);

+ 21
- 13
modules/UI/videolayout/VideoLayout.js View File

199
     /**
199
     /**
200
      * Checks if removed video is currently displayed and tries to display
200
      * Checks if removed video is currently displayed and tries to display
201
      * another one instead.
201
      * another one instead.
202
+     * Uses focusedID if any or dominantSpeakerID if any,
203
+     * otherwise elects new video, in this order.
202
      */
204
      */
203
-    updateRemovedVideo (id) {
205
+    updateAfterThumbRemoved (id) {
204
         if (!this.isCurrentlyOnLarge(id)) {
206
         if (!this.isCurrentlyOnLarge(id)) {
205
             return;
207
             return;
206
         }
208
         }
207
 
209
 
208
         let newId;
210
         let newId;
209
 
211
 
210
-        // We'll show user's avatar if he is the dominant speaker or if
211
-        // his video thumbnail is pinned
212
-        if (remoteVideos[id] && (id === pinnedId
213
-                                || id === currentDominantSpeaker)) {
214
-            newId = id;
215
-        } else {
216
-            // Otherwise select last visible video
212
+        if (pinnedId)
213
+            newId = pinnedId;
214
+        else if (currentDominantSpeaker)
215
+            newId = currentDominantSpeaker;
216
+        else // Otherwise select last visible video
217
             newId = this.electLastVisibleVideo();
217
             newId = this.electLastVisibleVideo();
218
-        }
219
 
218
 
220
         this.updateLargeVideo(newId);
219
         this.updateLargeVideo(newId);
221
     },
220
     },
304
      */
303
      */
305
     handleVideoThumbClicked (id) {
304
     handleVideoThumbClicked (id) {
306
         if(pinnedId) {
305
         if(pinnedId) {
307
-            var oldSmallVideo
308
-                    = VideoLayout.getSmallVideo(pinnedId);
306
+            var oldSmallVideo = VideoLayout.getSmallVideo(pinnedId);
309
             if (oldSmallVideo && !interfaceConfig.filmStripOnly)
307
             if (oldSmallVideo && !interfaceConfig.filmStripOnly)
310
                 oldSmallVideo.focus(false);
308
                 oldSmallVideo.focus(false);
311
         }
309
         }
978
             var oldSmallVideo = this.getSmallVideo(currentId);
976
             var oldSmallVideo = this.getSmallVideo(currentId);
979
         }
977
         }
980
 
978
 
981
-        // if !show then use default type - large video
982
-        return largeVideo.showContainer(show ? type : VIDEO_CONTAINER_TYPE)
979
+        let containerTypeToShow = type;
980
+        // if we are hiding a container and there is focusedVideo
981
+        // (pinned remote video) use its video type,
982
+        // if not then use default type - large video
983
+        if (!show) {
984
+            if(pinnedId)
985
+                containerTypeToShow = this.getRemoteVideoType(pinnedId);
986
+            else
987
+                containerTypeToShow = VIDEO_CONTAINER_TYPE;
988
+        }
989
+
990
+        return largeVideo.showContainer(containerTypeToShow)
983
             .then(() => {
991
             .then(() => {
984
                 if(oldSmallVideo)
992
                 if(oldSmallVideo)
985
                     oldSmallVideo && oldSmallVideo.updateView();
993
                     oldSmallVideo && oldSmallVideo.updateView();

Loading…
Cancel
Save