diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js index 7c24b4928..d15fc1384 100644 --- a/modules/UI/videolayout/LocalVideo.js +++ b/modules/UI/videolayout/LocalVideo.js @@ -9,6 +9,7 @@ var RTCBrowserType = require("../../RTC/RTCBrowserType"); function LocalVideo(VideoLayout) { this.videoSpanId = "localVideoContainer"; this.container = $("#localVideoContainer").get(0); + this.bindHoverHandler(); this.VideoLayout = VideoLayout; this.flipX = true; this.isLocal = true; @@ -173,19 +174,6 @@ LocalVideo.prototype.changeVideo = function (stream, isMuted) { localVideoContainerSelector.off('click'); localVideoContainerSelector.on('click', localVideoClick); - // Add hover handler - localVideoContainerSelector.hover( - function() { - self.showDisplayName(true); - }, - function() { - if (!LargeVideo.isLargeVideoVisible() || - !LargeVideo.isCurrentlyOnLarge(self.getResourceJid())) { - self.showDisplayName(false); - } - } - ); - if(isMuted) { APP.UI.setVideoMute(true); return; diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 04606c069..18d29a84c 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -20,6 +20,7 @@ function RemoteVideo(peerJid, VideoLayout) { nickfield.className = "nick"; nickfield.appendChild(document.createTextNode(this.resourceJid)); this.container.appendChild(nickfield); + this.bindHoverHandler(); this.flipX = false; this.isLocal = false; } @@ -252,21 +253,6 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) { if (RTCBrowserType.isTemasysPluginUsed()) sel = $('#' + newElementId); sel[0].onclick = onClickHandler; - - //FIXME - // Add hover handler - $(this.container).hover( - function() { - self.showDisplayName(true); - }, - function() { - // If the video has been "pinned" by the user we want to - // keep the display name on place. - if (!LargeVideo.isLargeVideoVisible() || - !LargeVideo.isCurrentlyOnLarge(self.getResourceJid())) - self.showDisplayName(false); - } - ); }, /** diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index 715f16fde..f13ebdb16 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -120,6 +120,26 @@ SmallVideo.createStreamElement = function (sid, stream) { return element; }; +/** + * Configures hoverIn/hoverOut handlers. + */ +SmallVideo.prototype.bindHoverHandler = function () { + // Add hover handler + var self = this; + $(this.container).hover( + function () { + self.showDisplayName(true); + }, + function () { + // If the video has been "pinned" by the user we want to + // keep the display name on place. + if (!LargeVideo.isLargeVideoVisible() || + !LargeVideo.isCurrentlyOnLarge(self.getResourceJid())) + self.showDisplayName(false); + } + ); +}; + /** * Updates the data for the indicator * @param id the id of the indicator