From e330dbf5d13ad3394033a2df59edf35eca3c4fee Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 22 Mar 2016 16:12:25 -0500 Subject: [PATCH 1/3] Fixes switching to pinned video when hiding a container. --- modules/UI/videolayout/VideoLayout.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index f73ae3e1b..add0f9ea1 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -978,8 +978,19 @@ var VideoLayout = { var oldSmallVideo = this.getSmallVideo(currentId); } - // if !show then use default type - large video - return largeVideo.showContainer(show ? type : VIDEO_CONTAINER_TYPE) + let containerTypeToShow = type; + // if we are hiding a container and there is focusedVideo + // (pinned remote video) use its video type, + // if not then use default type - large video + if (!show) { + if(focusedVideoResourceJid) + containerTypeToShow = this.getRemoteVideoType( + focusedVideoResourceJid); + else + containerTypeToShow = VIDEO_CONTAINER_TYPE; + } + + return largeVideo.showContainer(containerTypeToShow) .then(() => { if(oldSmallVideo) oldSmallVideo && oldSmallVideo.updateView(); From 94d98ec0ab335b5227539c9121060a3b145b9489 Mon Sep 17 00:00:00 2001 From: damencho Date: Wed, 23 Mar 2016 17:45:27 -0500 Subject: [PATCH 2/3] 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. --- modules/UI/shared_video/SharedVideo.js | 2 +- modules/UI/videolayout/LocalVideo.js | 5 ++++- modules/UI/videolayout/RemoteVideo.js | 8 +++++--- modules/UI/videolayout/VideoLayout.js | 19 +++++++++---------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js index ce3663175..690dac872 100644 --- a/modules/UI/shared_video/SharedVideo.js +++ b/modules/UI/shared_video/SharedVideo.js @@ -383,7 +383,7 @@ SharedVideoThumb.prototype.remove = function () { // Make sure that the large video is updated if are removing its // corresponding small video. - this.VideoLayout.updateRemovedVideo(this.id); + this.VideoLayout.updateAfterThumbRemoved(this.id); // Remove whole container if (this.container.parentNode) { diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js index 59ad9123c..09eeaa7f2 100644 --- a/modules/UI/videolayout/LocalVideo.js +++ b/modules/UI/videolayout/LocalVideo.js @@ -191,7 +191,10 @@ LocalVideo.prototype.changeVideo = function (stream) { let endedHandler = () => { localVideoContainer.removeChild(localVideo); - this.VideoLayout.updateRemovedVideo(this.id); + // when removing only the video element and we are on stage + // update the stage + if(this.VideoLayout.isCurrentlyOnLarge(this.id)) + this.VideoLayout.updateLargeVideo(this.id); stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler); }; stream.on(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler); diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 37e752946..7747ea822 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -156,8 +156,10 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) { console.info((isVideo ? "Video" : "Audio") + " removed " + this.id, select); - if (isVideo) - this.VideoLayout.updateRemovedVideo(this.id); + // when removing only the video element and we are on stage + // update the stage + if (isVideo && this.VideoLayout.isCurrentlyOnLarge(this.id)) + this.VideoLayout.updateLargeVideo(this.id); }; /** @@ -168,7 +170,7 @@ RemoteVideo.prototype.remove = function () { this.removeConnectionIndicator(); // Make sure that the large video is updated if are removing its // corresponding small video. - this.VideoLayout.updateRemovedVideo(this.id); + this.VideoLayout.updateAfterThumbRemoved(this.id); // Remove whole container if (this.container.parentNode) { this.container.parentNode.removeChild(this.container); diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index add0f9ea1..af7db05db 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -199,21 +199,21 @@ var VideoLayout = { /** * Checks if removed video is currently displayed and tries to display * another one instead. + * Uses focusedID if any or dominantSpeakerID if any, + * otherwise elects new video, in this order. */ - updateRemovedVideo (id) { + updateAfterThumbRemoved (id) { if (!this.isCurrentlyOnLarge(id)) { return; } let newId; - // We'll show user's avatar if he is the dominant speaker or if - // his video thumbnail is pinned - if (remoteVideos[id] && (id === pinnedId - || id === currentDominantSpeaker)) { - newId = id; - } else { - // Otherwise select last visible video + if (pinnedId) + newId = pinnedId; + else if (currentDominantSpeaker) + newId = currentDominantSpeaker; + else // Otherwise select last visible video newId = this.electLastVisibleVideo(); } @@ -304,8 +304,7 @@ var VideoLayout = { */ handleVideoThumbClicked (id) { if(pinnedId) { - var oldSmallVideo - = VideoLayout.getSmallVideo(pinnedId); + var oldSmallVideo = VideoLayout.getSmallVideo(pinnedId); if (oldSmallVideo && !interfaceConfig.filmStripOnly) oldSmallVideo.focus(false); } From 27607e8754e3c8717baef3b4f941164e01259b83 Mon Sep 17 00:00:00 2001 From: damencho Date: Thu, 24 Mar 2016 13:16:42 -0500 Subject: [PATCH 3/3] Update variable name to pinnedId. --- modules/UI/videolayout/VideoLayout.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index af7db05db..bfa844954 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -215,7 +215,6 @@ var VideoLayout = { newId = currentDominantSpeaker; else // Otherwise select last visible video newId = this.electLastVisibleVideo(); - } this.updateLargeVideo(newId); }, @@ -982,9 +981,8 @@ var VideoLayout = { // (pinned remote video) use its video type, // if not then use default type - large video if (!show) { - if(focusedVideoResourceJid) - containerTypeToShow = this.getRemoteVideoType( - focusedVideoResourceJid); + if(pinnedId) + containerTypeToShow = this.getRemoteVideoType(pinnedId); else containerTypeToShow = VIDEO_CONTAINER_TYPE; }