Removes remoteVideoTypes and uses the set/get in the small video instances.

This commit is contained in:
damencho 2016-03-15 13:36:17 -05:00
parent 3fc839cb37
commit 5837ef506c
1 changed files with 10 additions and 9 deletions

View File

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