From 5837ef506c2046429a8963c5a4c6b094f5c8b7eb Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 15 Mar 2016 13:36:17 -0500 Subject: [PATCH] Removes remoteVideoTypes and uses the set/get in the small video instances. --- modules/UI/videolayout/VideoLayout.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 787835b55..3a6e7c2fe 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -16,7 +16,6 @@ import PanelToggler from "../side_pannels/SidePanelToggler"; const RTCUIUtil = JitsiMeetJS.util.RTCUIHelper; var remoteVideos = {}; -var remoteVideoTypes = {}; var localVideoThumbnail = null; var currentDominantSpeaker = null; @@ -277,10 +276,11 @@ var VideoLayout = { /** * Return the type of the remote video. * @param id the id for the remote video - * @returns the video type video or screen. + * @returns {String} the video type video or screen. */ getRemoteVideoType (id) { - return remoteVideoTypes[id]; + let smallVideo = VideoLayout.getSmallVideo(id); + return smallVideo ? smallVideo.getVideoType() : null; }, handleVideoThumbClicked (noPinnedEndpointChangedEvent, @@ -340,10 +340,12 @@ var VideoLayout = { remoteVideo = new RemoteVideo(id, VideoLayout, eventEmitter); remoteVideos[id] = remoteVideo; - let videoType = remoteVideoTypes[id]; - if (videoType) { - remoteVideo.setVideoType(videoType); + let videoType = VideoLayout.getRemoteVideoType(id); + if (!videoType) { + // make video type the default one (camera) + videoType = VideoContainerType; } + remoteVideo.setVideoType(videoType); // In case this is not currently in the last n we don't show it. if (localLastNCount && localLastNCount > 0 && @@ -754,12 +756,11 @@ var VideoLayout = { }, onVideoTypeChanged (id, newVideoType) { - if (remoteVideoTypes[id] === newVideoType) { + if (VideoLayout.getRemoteVideoType(id) === newVideoType) { return; } console.info("Peer video type changed: ", id, newVideoType); - remoteVideoTypes[id] = newVideoType; var smallVideo; if (APP.conference.isLocalId(id)) { @@ -773,8 +774,8 @@ var VideoLayout = { } else { return; } - smallVideo.setVideoType(newVideoType); + if (this.isCurrentlyOnLarge(id)) { this.updateLargeVideo(id, true); }