ref(SmallVideo): add 'isCurrentlyOnLargeVideo'

This commit is contained in:
paweldomas 2016-09-19 14:04:55 -05:00
parent 4722054c3e
commit fceb512a03
3 changed files with 14 additions and 3 deletions

View File

@ -201,7 +201,7 @@ LocalVideo.prototype.changeVideo = function (stream) {
localVideoContainer.removeChild(localVideo); localVideoContainer.removeChild(localVideo);
// when removing only the video element and we are on stage // when removing only the video element and we are on stage
// update the stage // update the stage
if(this.VideoLayout.isCurrentlyOnLarge(this.id)) if(this.isCurrentlyOnLargeVideo())
this.VideoLayout.updateLargeVideo(this.id); this.VideoLayout.updateLargeVideo(this.id);
stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler); stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
}; };

View File

@ -223,7 +223,7 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {
// when removing only the video element and we are on stage // when removing only the video element and we are on stage
// update the stage // update the stage
if (isVideo && this.VideoLayout.isCurrentlyOnLarge(this.id)) if (isVideo && this.isCurrentlyOnLargeVideo())
this.VideoLayout.updateLargeVideo(this.id); this.VideoLayout.updateLargeVideo(this.id);
}; };

View File

@ -369,6 +369,17 @@ SmallVideo.prototype.hasVideo = function () {
return this.selectVideoElement().length !== 0; return this.selectVideoElement().length !== 0;
}; };
/**
* Checks whether the user associated with this <tt>SmallVideo</tt> is currently
* being displayed on the "large video".
*
* @return {boolean} <tt>true</tt> if the user is displayed on the large video
* or <tt>false</tt> otherwise.
*/
SmallVideo.prototype.isCurrentlyOnLargeVideo = function () {
return this.VideoLayout.isCurrentlyOnLarge(this.id);
};
/** /**
* Hides or shows the user's avatar. * Hides or shows the user's avatar.
* This update assumes that large video had been updated and we will * This update assumes that large video had been updated and we will
@ -392,7 +403,7 @@ SmallVideo.prototype.updateView = function () {
let avatar = this.$avatar; let avatar = this.$avatar;
var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id); var isCurrentlyOnLarge = this.isCurrentlyOnLargeVideo();
var showVideo = !this.isVideoMuted && !isCurrentlyOnLarge; var showVideo = !this.isVideoMuted && !isCurrentlyOnLarge;
var showAvatar; var showAvatar;