diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index dc21fdcd0..4058de5aa 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -207,7 +207,7 @@ var VideoLayout = { if (APP.conference.isLocalId(id)) { video = localVideoThumbnail; } - else if (remoteVideos[id]) { + else { video = remoteVideos[id]; } @@ -423,7 +423,9 @@ var VideoLayout = { * Shows the presence status message for the given video. */ setPresenceStatus (id, statusMsg) { - remoteVideos[id].setPresenceStatus(statusMsg); + let remoteVideo = remoteVideos[id]; + if (remoteVideo) + remoteVideo.setPresenceStatus(statusMsg); }, /** @@ -496,9 +498,13 @@ var VideoLayout = { if (APP.conference.isLocalId(id)) { localVideoThumbnail.showAudioIndicator(isMuted); } else { - remoteVideos[id].showAudioIndicator(isMuted); + let remoteVideo = remoteVideos[id]; + if (!remoteVideo) + return; + + remoteVideo.showAudioIndicator(isMuted); if (APP.conference.isModerator) { - remoteVideos[id].updateRemoteVideoMenu(isMuted); + remoteVideo.updateRemoteVideoMenu(isMuted); } } }, @@ -510,8 +516,9 @@ var VideoLayout = { if (APP.conference.isLocalId(id)) { localVideoThumbnail.setMutedView(value); } else { - var remoteVideo = remoteVideos[id]; - remoteVideo.setMutedView(value); + let remoteVideo = remoteVideos[id]; + if (remoteVideo) + remoteVideo.setMutedView(value); } if (this.isCurrentlyOnLarge(id)) { @@ -528,7 +535,9 @@ var VideoLayout = { APP.conference.isLocalId(id)) { localVideoThumbnail.setDisplayName(displayName); } else { - remoteVideos[id].setDisplayName(displayName, status); + let remoteVideo = remoteVideos[id]; + if (remoteVideo) + remoteVideo.setDisplayName(displayName, status); } }, @@ -650,9 +659,13 @@ var VideoLayout = { console.error("No remote video for: " + resourceJid); isReceived = false; } else if (resourceJid && + //TOFIX: smallVideo may be undefined smallVideo.isVisible() && lastNEndpoints.indexOf(resourceJid) < 0 && localLastNSet.indexOf(resourceJid) >= 0) { + + // TOFIX: if we're here we already know that the smallVideo + // exists. Look at the previous FIX above. if (smallVideo) smallVideo.showPeerContainer('avatar'); else if (!APP.conference.isLocalId(resourceJid)) @@ -753,8 +766,9 @@ var VideoLayout = { * @param object the stats data */ updateConnectionStats (id, percent, object) { - if (remoteVideos[id]) { - remoteVideos[id].updateStatsIndicator(percent, object); + let remoteVideo = remoteVideos[id]; + if (remoteVideo) { + remoteVideo.updateStatsIndicator(percent, object); } }, @@ -763,15 +777,19 @@ var VideoLayout = { * @param id */ hideConnectionIndicator (id) { - remoteVideos[id].hideConnectionIndicator(); + let remoteVideo = remoteVideos[id]; + if (remoteVideo) + remoteVideo.hideConnectionIndicator(); }, /** * Hides all the indicators */ hideStats () { - for(var video in remoteVideos) { - remoteVideos[video].hideIndicator(); + for (var video in remoteVideos) { + let remoteVideo = remoteVideos[video]; + if (remoteVideo) + remoteVideo.hideIndicator(); } localVideoThumbnail.hideIndicator(); },