瀏覽代碼

Fixes returning to dominant speaker after closing shared video. Renames a method and fix its behaviour was handling both case when removing just video element in small videos (local or remote) and when we are removingParticipantContainer, now just handles the second one and uses focusedID if any or dominantSpeakerID if any, otherwise elects new video.

j8
damencho 9 年之前
父節點
當前提交
94d98ec0ab

+ 1
- 1
modules/UI/shared_video/SharedVideo.js 查看文件

383
 
383
 
384
     // Make sure that the large video is updated if are removing its
384
     // Make sure that the large video is updated if are removing its
385
     // corresponding small video.
385
     // corresponding small video.
386
-    this.VideoLayout.updateRemovedVideo(this.id);
386
+    this.VideoLayout.updateAfterThumbRemoved(this.id);
387
 
387
 
388
     // Remove whole container
388
     // Remove whole container
389
     if (this.container.parentNode) {
389
     if (this.container.parentNode) {

+ 4
- 1
modules/UI/videolayout/LocalVideo.js 查看文件

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 查看文件

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);

+ 9
- 10
modules/UI/videolayout/VideoLayout.js 查看文件

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
         }
218
         }
219
 
219
 
304
      */
304
      */
305
     handleVideoThumbClicked (id) {
305
     handleVideoThumbClicked (id) {
306
         if(pinnedId) {
306
         if(pinnedId) {
307
-            var oldSmallVideo
308
-                    = VideoLayout.getSmallVideo(pinnedId);
307
+            var oldSmallVideo = VideoLayout.getSmallVideo(pinnedId);
309
             if (oldSmallVideo && !interfaceConfig.filmStripOnly)
308
             if (oldSmallVideo && !interfaceConfig.filmStripOnly)
310
                 oldSmallVideo.focus(false);
309
                 oldSmallVideo.focus(false);
311
         }
310
         }

Loading…
取消
儲存