From 2ffe178456e94e916d22b10848ad24212d692d0a Mon Sep 17 00:00:00 2001 From: paweldomas Date: Thu, 30 Jul 2015 10:31:02 +0200 Subject: [PATCH] Fixes issue with missing avatar for Jigasi user. Fixes issue with avatar not being displayed when user has no video. Removed duplicated logic for checking video muted status(removed from LargeVideo which exists in SmallVideo). --- modules/UI/avatar/Avatar.js | 5 +++-- modules/UI/videolayout/LargeVideo.js | 15 ++------------- modules/UI/videolayout/SmallVideo.js | 4 +++- modules/UI/videolayout/VideoLayout.js | 5 +++-- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/modules/UI/avatar/Avatar.js b/modules/UI/avatar/Avatar.js index d51a92c37..2f51f0f72 100644 --- a/modules/UI/avatar/Avatar.js +++ b/modules/UI/avatar/Avatar.js @@ -52,8 +52,9 @@ var Avatar = { } var id = users[jid]; if (!id) { - console.warn("No avatar stored yet for " + jid); - return null; + console.warn( + "No avatar stored yet for " + jid + " - using JID as ID"); + id = jid; } return 'https://www.gravatar.com/avatar/' + MD5.hexdigest(id.trim().toLowerCase()) + diff --git a/modules/UI/videolayout/LargeVideo.js b/modules/UI/videolayout/LargeVideo.js index c45e1f1cd..e4124d469 100644 --- a/modules/UI/videolayout/LargeVideo.js +++ b/modules/UI/videolayout/LargeVideo.js @@ -224,20 +224,9 @@ function updateActiveSpeakerAvatarSrc() { var url = Avatar.getActiveSpeakerUrl(jid); if (avatar.src === url) return; - var isMuted = null; - if (!currentSmallVideo.isLocal && - !LargeVideo.VideoLayout.isInLastN(currentSmallVideo.getResourceJid())) { - isMuted = true; - } - else - { - isMuted = APP.RTC.isVideoMuted(jid); - } - - if (jid && isMuted !== null) { + if (jid) { avatar.src = url; - $("#largeVideo").css("visibility", isMuted ? "hidden" : "visible"); - currentSmallVideo.showAvatar(isMuted); + currentSmallVideo.showAvatar(); } } diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index cbe2d619a..319d59d94 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -325,7 +325,9 @@ SmallVideo.prototype.showAvatar = function (show) { } else { - show = APP.RTC.isVideoMuted(this.peerJid); + // We want to show the avatar when the video is muted or not exists + // that is when 'true' or 'null' is returned + show = APP.RTC.isVideoMuted(this.peerJid) !== false; } } diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index e165b99a2..8fb2cd1de 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -864,9 +864,10 @@ var VideoLayout = (function (my) { if(!isVisible && focusedVideoResourceJid) { var smallVideo = VideoLayout.getSmallVideo(focusedVideoResourceJid); - if(smallVideo) + if(smallVideo) { smallVideo.focus(false); - smallVideo.showAvatar(); + smallVideo.showAvatar(); + } focusedVideoResourceJid = null; } };