Shows dominant speaker icon for the local user, when he is the dominant speaker.

This commit is contained in:
damencho 2016-02-08 15:41:04 -06:00
parent ff4de4cb5b
commit e81d3c02ad
3 changed files with 36 additions and 35 deletions

View File

@ -342,41 +342,6 @@ RemoteVideo.prototype.updateRemoteVideoMenu = function (isMuted) {
} }
}; };
/**
* Updates the Indicator for dominant speaker.
*
* @param isSpeaker indicates the current indicator state
*/
RemoteVideo.prototype.updateDominantSpeakerIndicator = function (isSpeaker) {
if (!this.container) {
console.warn( "Unable to set dominant speaker indicator - "
+ this.videoSpanId + " does not exist");
return;
}
var indicatorSpan
= $('#' + this.videoSpanId + '>span.dominantspeakerindicator');
// If we do not have an indicator for this video.
if (indicatorSpan.length <= 0) {
indicatorSpan = document.createElement('span');
indicatorSpan.innerHTML
= "<i id='speakerindicatoricon' class='fa fa-bullhorn'></i>";
indicatorSpan.className = 'dominantspeakerindicator';
$('#' + this.videoSpanId)[0].appendChild(indicatorSpan);
// adds a tooltip
UIUtils.setTooltip(indicatorSpan, "speaker", "left");
APP.translation.translateElement($(indicatorSpan));
}
$(indicatorSpan).css("visibility", isSpeaker ? "visible" : "hidden");
};
/** /**
* Sets the display name for the given video span id. * Sets the display name for the given video span id.
*/ */

View File

@ -382,4 +382,38 @@ SmallVideo.prototype.avatarChanged = function (avatarUrl) {
} }
}; };
/**
* Updates the Indicator for dominant speaker.
*
* @param isSpeaker indicates the current indicator state
*/
SmallVideo.prototype.updateDominantSpeakerIndicator = function (isSpeaker) {
if (!this.container) {
console.warn( "Unable to set dominant speaker indicator - "
+ this.videoSpanId + " does not exist");
return;
}
var indicatorSpan
= $('#' + this.videoSpanId + '>span.dominantspeakerindicator');
// If we do not have an indicator for this video.
if (indicatorSpan.length <= 0) {
indicatorSpan = document.createElement('span');
indicatorSpan.innerHTML
= "<i id='speakerindicatoricon' class='fa fa-bullhorn'></i>";
indicatorSpan.className = 'dominantspeakerindicator';
$('#' + this.videoSpanId)[0].appendChild(indicatorSpan);
// adds a tooltip
UIUtil.setTooltip(indicatorSpan, "speaker", "left");
APP.translation.translateElement($(indicatorSpan));
}
$(indicatorSpan).css("visibility", isSpeaker ? "visible" : "hidden");
};
export default SmallVideo; export default SmallVideo;

View File

@ -538,6 +538,7 @@ var VideoLayout = {
if(oldSpeakerRemoteVideo) if(oldSpeakerRemoteVideo)
{ {
oldSpeakerRemoteVideo.updateDominantSpeakerIndicator(false); oldSpeakerRemoteVideo.updateDominantSpeakerIndicator(false);
localVideoThumbnail.updateDominantSpeakerIndicator(true);
currentDominantSpeaker = null; currentDominantSpeaker = null;
} }
return; return;
@ -550,6 +551,7 @@ var VideoLayout = {
// Update the current dominant speaker. // Update the current dominant speaker.
remoteVideo.updateDominantSpeakerIndicator(true); remoteVideo.updateDominantSpeakerIndicator(true);
localVideoThumbnail.updateDominantSpeakerIndicator(false);
// let's remove the indications from the remote video if any // let's remove the indications from the remote video if any
if (oldSpeakerRemoteVideo) { if (oldSpeakerRemoteVideo) {