From 303287f7a651cd3a7ad88c62e3e41856ba0973f7 Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 11 Dec 2015 14:18:16 -0600 Subject: [PATCH] Fixes a problem with receiving presence for start muted video before creating the stream element, which will end up that the muted video element will hide the avatar. --- modules/RTC/MediaStream.js | 4 ++++ modules/UI/videolayout/SmallVideo.js | 7 +++++++ modules/UI/videolayout/VideoLayout.js | 3 +++ 3 files changed, 14 insertions(+) diff --git a/modules/RTC/MediaStream.js b/modules/RTC/MediaStream.js index fc500781e..343285956 100644 --- a/modules/RTC/MediaStream.js +++ b/modules/RTC/MediaStream.js @@ -54,4 +54,8 @@ MediaStream.prototype.setMute = function (value) { this.muted = value; }; +MediaStream.prototype.getMute = function () { + return this.muted; +}; + module.exports = MediaStream; diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index 5352b22ee..06fee6ef7 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -112,6 +112,13 @@ SmallVideo.createStreamElement = function (stream) { : document.createElement('audio'); if (isVideo) { element.setAttribute("muted", "true"); + + // the presence for muted (start muted) can be received before creating + // the element, so we need to check here and if that is the case + // hide the element + if (stream.getMute()) { + $(element).hide(); + } } if (!RTCBrowserType.isIExplorer()) { diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index d98a18464..021dc5c17 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -579,6 +579,9 @@ var VideoLayout = (function (my) { remoteVideo.showVideoIndicator(value); var el = remoteVideo.selectVideoElement(); + // the presence and trigger of onVideoMute can be earlier than + // creating the stream element. So show and hide can be ignored + // we need to take care for them also on creating the stream elem if (!value) el.show(); else