Make sure remote video exist before we use it

This commit is contained in:
yanas 2016-04-28 17:50:28 -05:00
parent 4a4e25de28
commit edf2f8114b
1 changed files with 30 additions and 12 deletions

View File

@ -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,7 +516,8 @@ var VideoLayout = {
if (APP.conference.isLocalId(id)) {
localVideoThumbnail.setMutedView(value);
} else {
var remoteVideo = remoteVideos[id];
let remoteVideo = remoteVideos[id];
if (remoteVideo)
remoteVideo.setMutedView(value);
}
@ -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,7 +777,9 @@ var VideoLayout = {
* @param id
*/
hideConnectionIndicator (id) {
remoteVideos[id].hideConnectionIndicator();
let remoteVideo = remoteVideos[id];
if (remoteVideo)
remoteVideo.hideConnectionIndicator();
},
/**
@ -771,7 +787,9 @@ var VideoLayout = {
*/
hideStats () {
for (var video in remoteVideos) {
remoteVideos[video].hideIndicator();
let remoteVideo = remoteVideos[video];
if (remoteVideo)
remoteVideo.hideIndicator();
}
localVideoThumbnail.hideIndicator();
},