Changes active speaker indication by only adding greyscale filter. Makes sure the display name is visible on rollover event before the video is available.

This commit is contained in:
yanas 2014-06-18 17:45:31 +03:00
parent 1a0cd4f1c6
commit f53bb6d8c6
3 changed files with 35 additions and 55 deletions

26
app.js
View File

@ -244,7 +244,9 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
'participant_' + Strophe.getResourceFromJid(data.peerjid)); 'participant_' + Strophe.getResourceFromJid(data.peerjid));
} else { } else {
if (data.stream.id !== 'mixedmslabel') { if (data.stream.id !== 'mixedmslabel') {
console.error('can not associate stream', data.stream.id, 'with a participant'); console.error( 'can not associate stream',
data.stream.id,
'with a participant');
// We don't want to add it here since it will cause troubles // We don't want to add it here since it will cause troubles
return; return;
} }
@ -304,14 +306,22 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
VideoLayout.handleVideoThumbClicked(vid.src); VideoLayout.handleVideoThumbClicked(vid.src);
}); });
// Add hover handler // Add hover handler
sel.hover( $(container).hover(
function() { function() {
VideoLayout.showDisplayName(container.id, true); VideoLayout.showDisplayName(container.id, true);
}, },
function() { function() {
if (focusedVideoSrc !== vid.src) var videoSrc = null;
VideoLayout.showDisplayName(container.id, false); if ($('#' + container.id + '>video')
&& $('#' + container.id + '>video').length > 0) {
videoSrc = $('#' + container.id + '>video').get(0).src;
} }
// If the video has been "pinned" by the user we want to keep the
// display name on place.
if (focusedVideoSrc !== videoSrc)
VideoLayout.showDisplayName(container.id, false);
}
); );
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32 // an attempt to work around https://github.com/jitsi/jitmeet/issues/32

View File

@ -60,8 +60,7 @@
border: 0px !important; border: 0px !important;
} }
#remoteVideos .videocontainer>video, #remoteVideos .videocontainer>video {
#remoteVideos .videocontainer>canvas {
border-radius:4px; border-radius:4px;
} }
@ -86,8 +85,7 @@
#etherpad, #etherpad,
#localVideoWrapper>video, #localVideoWrapper>video,
#localVideoWrapper, #localVideoWrapper,
.videocontainer>video, .videocontainer>video {
.videocontainer>canvas {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
@ -96,6 +94,11 @@
height: 100%; height: 100%;
} }
.activespeaker {
-webkit-filter: grayscale(1) brightness(2);
filter: grayscale(1) brightness(2);
}
#etherpad, #etherpad,
#presentation { #presentation {
text-align: center; text-align: center;

View File

@ -552,54 +552,21 @@ var VideoLayout = (function (my) {
else if (resourceJid === currentActiveSpeaker) else if (resourceJid === currentActiveSpeaker)
currentActiveSpeaker = null; currentActiveSpeaker = null;
var activeSpeakerCanvas = $('#' + videoSpanId + '>canvas'); var video = $('#' + videoSpanId + '>video');
var videoElement = $('#' + videoSpanId + '>video');
var canvasSize = calculateThumbnailSize();
if (isEnable && (!activeSpeakerCanvas if (video && video.length > 0) {
|| activeSpeakerCanvas.length === 0)) { var videoElement = video.get(0);
activeSpeakerCanvas = document.createElement('canvas');
activeSpeakerCanvas.width = canvasSize[0];
activeSpeakerCanvas.height = canvasSize[1];
// We flip the canvas image if this is the local video.
if (videoSpanId === 'localVideoWrapper')
activeSpeakerCanvas.className += " flipVideoX";
videoSpan.appendChild(activeSpeakerCanvas);
activeSpeakerCanvas.addEventListener(
'click',
function() {
VideoLayout.handleVideoThumbClicked(
videoElement.get(0).src);
}, false);
}
else {
activeSpeakerCanvas = activeSpeakerCanvas.get(0);
}
if (videoElement && videoElement.length > 0) {
var video = document.getElementById(videoElement.get(0).id);
if (isEnable) { if (isEnable) {
var context = activeSpeakerCanvas.getContext('2d'); if (!videoElement.classList.contains("activespeaker"))
videoElement.classList.add("activespeaker");
context.fillRect(0, 0, canvasSize[0], canvasSize[1]); VideoLayout.showDisplayName(videoSpanId, true);
context.drawImage(video, 0, 0, canvasSize[0], canvasSize[1]);
Util.imageToGrayScale(activeSpeakerCanvas);
VideoLayout
.showDisplayName(videoSpanId, true);
activeSpeakerCanvas
.setAttribute('style', 'display:block !important;');
video.setAttribute('style', 'display:none !important;');
} }
else { else {
VideoLayout VideoLayout.showDisplayName(videoSpanId, false);
.showDisplayName(videoSpanId, false);
video.setAttribute('style', 'display:block !important;'); if (videoElement.classList.contains("activespeaker"))
activeSpeakerCanvas videoElement.classList.remove("activespeaker");
.setAttribute('style', 'display:none !important;');
} }
} }
}; };