Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Fixes video switching issue. 'oldSmallVideo' field is no longer used as it is might be overwritten before fadeOut 'complete' callback of #largeVideo is called(and we miss UI update on it).
paweldomas9b4ee7c0c5d9
diff --git a/modules/UI/videolayout/LargeVideo.js b/modules/UI/videolayout/LargeVideo.jsindex 1e1adf0b0b..fb3cfcd329 100644--- a/modules/UI/videolayout/LargeVideo.js+++ b/modules/UI/videolayout/LargeVideo.js@@ -13,7 +13,6 @@ var currentVideoHeight = null;var getVideoSize = getCameraVideoSize;var getVideoPosition = getCameraVideoPosition;var currentSmallVideo = null;-var oldSmallVideo = null;@@ -236,22 +235,11 @@ function changeVideo(isVisible) {// Only if the large video is currently visible.- // Disable previous dominant speaker video.- if (oldSmallVideo) {- oldSmallVideo.enableDominantSpeaker(false);- }-- // Enable new dominant speaker in the remote videos section.- if (currentSmallVideo) {- currentSmallVideo.enableDominantSpeaker(true);- }-if (isVisible) {+ LargeVideo.VideoLayout.largeVideoUpdated(currentSmallVideo);+$('#largeVideo').fadeIn(300);}-- if(oldSmallVideo)- oldSmallVideo.showAvatar();}var LargeVideo = {@@ -290,34 +278,31 @@ var LargeVideo = {/*** Updates the large video with the given new video source.*/- updateLargeVideo: function(resourceJid, forceUpdate) {+ updateLargeVideo: function (resourceJid, forceUpdate) {var newSmallVideo = this.VideoLayout.getSmallVideo(resourceJid);console.log('hover in ' + resourceJid + ', video: ', newSmallVideo);if (!LargeVideo.isCurrentlyOnLarge(resourceJid) || forceUpdate) {$('#activeSpeaker').css('visibility', 'hidden');- if(currentSmallVideo) {+ var oldSmallVideo = null;+ if (currentSmallVideo) {oldSmallVideo = currentSmallVideo;- } else {- oldSmallVideo = null;}-currentSmallVideo = newSmallVideo;+var oldJid = null;- if(oldSmallVideo)+ if (oldSmallVideo)oldJid = oldSmallVideo.peerJid;-if (oldJid !== resourceJid) {// we want the notification to trigger even if userJid is undefined,// or null.- this.eventEmitter.emit(UIEvents.SELECTED_ENDPOINT,- resourceJid);+ this.eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, resourceJid);}$('#largeVideo').fadeOut(300,changeVideo.bind($('#largeVideo'), this.isLargeVideoVisible()));} else {- if(currentSmallVideo) {+ if (currentSmallVideo) {currentSmallVideo.showAvatar();}}diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.jsindex 54c23d34d0..8e698649d1 100644--- a/modules/UI/videolayout/VideoLayout.js+++ b/modules/UI/videolayout/VideoLayout.js@@ -167,6 +167,26 @@ var VideoLayout = (function (my) {return LargeVideo.getResourceJid();};+ /**+ * Called when large video update is finished+ * @param currentSmallVideo small video currently displayed on large video+ */+ my.largeVideoUpdated = function (currentSmallVideo) {+ // Makes sure that dominant speaker UI+ // is enabled only on current small video+ localVideoThumbnail.enableDominantSpeaker(+ localVideoThumbnail === currentSmallVideo);+ Object.keys(remoteVideos).forEach(+ function (resourceJid) {+ var remoteVideo = remoteVideos[resourceJid];+ if (remoteVideo) {+ remoteVideo.enableDominantSpeaker(+ remoteVideo === currentSmallVideo);+ }+ }+ );+ };+my.handleVideoThumbClicked = function(noPinnedEndpointChangedEvent,resourceJid) {if(focusedVideoResourceJid) {