Removed duplicated code for adding video thumbnail's hover handler.

This commit is contained in:
paweldomas 2015-08-21 16:37:57 +02:00
parent a8a0945d73
commit 4c2f0d3600
3 changed files with 22 additions and 28 deletions

View File

@ -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;

View File

@ -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);
}
);
},
/**

View File

@ -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