From fceb512a032a87d417e75d0b5016cf3d0e146055 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Mon, 19 Sep 2016 14:04:55 -0500 Subject: [PATCH] ref(SmallVideo): add 'isCurrentlyOnLargeVideo' --- modules/UI/videolayout/LocalVideo.js | 2 +- modules/UI/videolayout/RemoteVideo.js | 2 +- modules/UI/videolayout/SmallVideo.js | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js index 9c2111e4e..1a070652b 100644 --- a/modules/UI/videolayout/LocalVideo.js +++ b/modules/UI/videolayout/LocalVideo.js @@ -201,7 +201,7 @@ LocalVideo.prototype.changeVideo = function (stream) { localVideoContainer.removeChild(localVideo); // when removing only the video element and we are on stage // update the stage - if(this.VideoLayout.isCurrentlyOnLarge(this.id)) + if(this.isCurrentlyOnLargeVideo()) this.VideoLayout.updateLargeVideo(this.id); stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler); }; diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 52d3d6220..85df94bfe 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -223,7 +223,7 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) { // when removing only the video element and we are on stage // update the stage - if (isVideo && this.VideoLayout.isCurrentlyOnLarge(this.id)) + if (isVideo && this.isCurrentlyOnLargeVideo()) this.VideoLayout.updateLargeVideo(this.id); }; diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index 87bfe072b..5cc9769f1 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -369,6 +369,17 @@ SmallVideo.prototype.hasVideo = function () { return this.selectVideoElement().length !== 0; }; +/** + * Checks whether the user associated with this SmallVideo is currently + * being displayed on the "large video". + * + * @return {boolean} true if the user is displayed on the large video + * or false otherwise. + */ +SmallVideo.prototype.isCurrentlyOnLargeVideo = function () { + return this.VideoLayout.isCurrentlyOnLarge(this.id); +}; + /** * Hides or shows the user's avatar. * This update assumes that large video had been updated and we will @@ -392,7 +403,7 @@ SmallVideo.prototype.updateView = function () { let avatar = this.$avatar; - var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id); + var isCurrentlyOnLarge = this.isCurrentlyOnLargeVideo(); var showVideo = !this.isVideoMuted && !isCurrentlyOnLarge; var showAvatar;