Fixes bugs with thumbnails getting black when prezi is playing or etherpad is viewed.

This commit is contained in:
fo 2014-11-28 16:02:48 +02:00
parent 36065b935c
commit f0a4c08f26
5 changed files with 66 additions and 47 deletions

View File

@ -73,8 +73,9 @@ var Avatar = (function(my) {
} }
//if the user is the currently focused, the dominant speaker or if //if the user is the currently focused, the dominant speaker or if
//there is no focused and no dominant speaker //there is no focused and no dominant speaker and the large video is
if (activeSpeakerJid === jid) { //currently shown
if (activeSpeakerJid === jid && VideoLayout.isLargeVideoOnTop()) {
setVisibility($("#largeVideo"), !show); setVisibility($("#largeVideo"), !show);
setVisibility($('#activeSpeakerAvatar'), show); setVisibility($('#activeSpeakerAvatar'), show);
setVisibility(avatar, false); setVisibility(avatar, false);

View File

@ -36,8 +36,6 @@
#remoteVideos .videocontainer { #remoteVideos .videocontainer {
display: inline-block; display: inline-block;
background-color: black; background-color: black;
background-repeat: no-repeat;
background-position: 45;
background-size: contain; background-size: contain;
border-radius:8px; border-radius:8px;
border: 2px solid #212425; border: 2px solid #212425;
@ -376,6 +374,7 @@
position: absolute; position: absolute;
z-index: 0; z-index: 0;
border-radius:10px; border-radius:10px;
pointer-events: none;
} }
#mixedstream { #mixedstream {

View File

@ -48,29 +48,35 @@ var Etherpad = (function (my) {
} else { } else {
VideoLayout.setLargeVideoVisible(false); VideoLayout.setLargeVideoVisible(false);
} }
});
$('#etherpad>iframe').fadeIn(300, function () { $('#etherpad>iframe').fadeIn(300, function () {
document.body.style.background = '#eeeeee'; document.body.style.background = '#eeeeee';
$('#etherpad>iframe').css({visibility: 'visible'}); $('#etherpad>iframe').css({visibility: 'visible'});
$('#etherpad').css({zIndex: 2}); $('#etherpad').css({zIndex: 2});
}); });
});
} }
else if ($('#etherpad>iframe')) { else if ($('#etherpad>iframe')) {
$('#etherpad>iframe').fadeOut(300, function () { $('#etherpad>iframe').fadeOut(300, function () {
$('#etherpad>iframe').css({visibility: 'hidden'}); $('#etherpad>iframe').css({visibility: 'hidden'});
$('#etherpad').css({zIndex: 0}); $('#etherpad').css({zIndex: 0});
document.body.style.background = 'black'; document.body.style.background = 'black';
});
if (!isPresentation) { if (!isPresentation) {
$('#largeVideo').fadeIn(300, function () { $('#largeVideo').fadeIn(300, function () {
VideoLayout.setLargeVideoVisible(true); VideoLayout.setLargeVideoVisible(true);
}); });
} }
});
} }
resize(); resize();
}; };
my.isVisible = function() {
var etherpadIframe = $('#etherpad>iframe');
return etherpadIframe && etherpadIframe.is(':visible');
};
/** /**
* Resizes the etherpad. * Resizes the etherpad.
*/ */

View File

@ -13,23 +13,24 @@ var Prezi = (function (my) {
* Shows/hides a presentation. * Shows/hides a presentation.
*/ */
my.setPresentationVisible = function (visible) { my.setPresentationVisible = function (visible) {
var prezi = $('#presentation>iframe');
if (visible) { if (visible) {
// Trigger the video.selected event to indicate a change in the // Trigger the video.selected event to indicate a change in the
// large video. // large video.
$(document).trigger("video.selected", [true]); $(document).trigger("video.selected", [true]);
$('#largeVideo').fadeOut(300, function () { $('#largeVideo').fadeOut(300);
VideoLayout.setLargeVideoVisible(false); prezi.fadeIn(300, function() {
$('#presentation>iframe').fadeIn(300, function() { prezi.css({opacity:'1'});
$('#presentation>iframe').css({opacity:'1'});
ToolbarToggler.dockToolbar(true); ToolbarToggler.dockToolbar(true);
VideoLayout.setLargeVideoVisible(false);
}); });
}); $('#activeSpeakerAvatar').css('visibility', 'hidden');
} }
else { else {
if ($('#presentation>iframe').css('opacity') == '1') { if (prezi.css('opacity') == '1') {
$('#presentation>iframe').fadeOut(300, function () { prezi.fadeOut(300, function () {
$('#presentation>iframe').css({opacity:'0'}); prezi.css({opacity:'0'});
$('#reloadPresentation').css({display:'none'}); $('#reloadPresentation').css({display:'none'});
$('#largeVideo').fadeIn(300, function() { $('#largeVideo').fadeIn(300, function() {
VideoLayout.setLargeVideoVisible(true); VideoLayout.setLargeVideoVisible(true);
@ -332,8 +333,9 @@ var Prezi = (function (my) {
* On video selected event. * On video selected event.
*/ */
$(document).bind('video.selected', function (event, isPresentation) { $(document).bind('video.selected', function (event, isPresentation) {
if (!isPresentation && $('#presentation>iframe')) if (!isPresentation && $('#presentation>iframe')) {
Prezi.setPresentationVisible(false); Prezi.setPresentationVisible(false);
}
}); });
$(window).resize(function () { $(window).resize(function () {

View File

@ -310,6 +310,7 @@ var VideoLayout = (function (my) {
connection.emuc.findJidFromResource( connection.emuc.findJidFromResource(
largeVideoState.userResourceJid)); largeVideoState.userResourceJid));
} }
}; };
my.handleVideoThumbClicked = function(videoSrc, my.handleVideoThumbClicked = function(videoSrc,
@ -318,7 +319,7 @@ var VideoLayout = (function (my) {
// Restore style for previously focused video // Restore style for previously focused video
var oldContainer = null; var oldContainer = null;
if(focusedVideoInfo) { if(focusedVideoInfo) {
var focusResourceJid = focusedVideoInfo.resouceJid; var focusResourceJid = focusedVideoInfo.resourceJid;
oldContainer = getParticipantContainer(focusResourceJid); oldContainer = getParticipantContainer(focusResourceJid);
} }
@ -354,7 +355,7 @@ var VideoLayout = (function (my) {
// Lock new video // Lock new video
focusedVideoInfo = { focusedVideoInfo = {
src: videoSrc, src: videoSrc,
resouceJid: resourceJid resourceJid: resourceJid
}; };
// Update focused/pinned interface. // Update focused/pinned interface.
@ -368,7 +369,8 @@ var VideoLayout = (function (my) {
} }
} }
if ($('#largeVideo').attr('src') === videoSrc) { if ($('#largeVideo').attr('src') === videoSrc &&
VideoLayout.isLargeVideoOnTop()) {
return; return;
} }
@ -433,15 +435,18 @@ var VideoLayout = (function (my) {
$('#largeVideo').css({visibility: 'hidden'}); $('#largeVideo').css({visibility: 'hidden'});
$('.watermark').css({visibility: 'hidden'}); $('.watermark').css({visibility: 'hidden'});
VideoLayout.enableDominantSpeaker(resourceJid, false); VideoLayout.enableDominantSpeaker(resourceJid, false);
var focusJid = VideoLayout.getLargeVideoState().userJid; if(focusedVideoInfo) {
var oldContainer = getParticipantContainer(focusJid); var focusResourceJid = focusedVideoInfo.resourceJid;
var oldContainer = getParticipantContainer(focusResourceJid);
if (oldContainer) { if (oldContainer && oldContainer.length > 0) {
oldContainer.removeClass("videoContainerFocused"); oldContainer.removeClass("videoContainerFocused");
} }
focusedVideoInfo = null; focusedVideoInfo = null;
if(focusJid) { if(focusResourceJid) {
Avatar.showUserAvatar(focusJid); Avatar.showUserAvatar(
connection.emuc.findJidFromResource(focusResourceJid));
}
} }
} }
}; };
@ -455,6 +460,10 @@ var VideoLayout = (function (my) {
return $('#largeVideo').is(':visible'); return $('#largeVideo').is(':visible');
}; };
my.isLargeVideoOnTop = function () {
return !Prezi.isPresentationVisible() && !Etherpad.isVisible();
};
/** /**
* Checks if container for participant identified by given peerJid exists * Checks if container for participant identified by given peerJid exists
* in the document and creates it eventually. * in the document and creates it eventually.
@ -596,13 +605,14 @@ var VideoLayout = (function (my) {
* no actual video). * no actual video).
*/ */
var videoThumb = $('#' + container.id + '>video').get(0); var videoThumb = $('#' + container.id + '>video').get(0);
if (videoThumb) {
if (videoThumb)
VideoLayout.handleVideoThumbClicked( VideoLayout.handleVideoThumbClicked(
RTC.getVideoSrc(videoThumb), RTC.getVideoSrc(videoThumb),
false, false,
Strophe.getResourceFromJid(peerJid)); Strophe.getResourceFromJid(peerJid));
}
event.stopPropagation();
event.preventDefault(); event.preventDefault();
return false; return false;
}; };
@ -1098,21 +1108,21 @@ var VideoLayout = (function (my) {
if (video && video.length > 0) { if (video && video.length > 0) {
if (isEnable) { if (isEnable) {
VideoLayout.showDisplayName(videoContainerId, true); var isLargeVideoVisible = VideoLayout.isLargeVideoOnTop();
VideoLayout.showDisplayName(videoContainerId, isLargeVideoVisible);
if (!videoSpan.classList.contains("dominantspeaker")) if (!videoSpan.classList.contains("dominantspeaker"))
videoSpan.classList.add("dominantspeaker"); videoSpan.classList.add("dominantspeaker");
video.css({visibility: 'hidden'});
} }
else { else {
VideoLayout.showDisplayName(videoContainerId, false); VideoLayout.showDisplayName(videoContainerId, false);
if (videoSpan.classList.contains("dominantspeaker")) if (videoSpan.classList.contains("dominantspeaker"))
videoSpan.classList.remove("dominantspeaker"); videoSpan.classList.remove("dominantspeaker");
video.css({visibility: 'visible'});
} }
Avatar.showUserAvatar(
connection.emuc.findJidFromResource(resourceJid));
} }
}; };
@ -1715,12 +1725,13 @@ var VideoLayout = (function (my) {
= VideoLayout.getPeerContainerResourceJid(videoParent[0]); = VideoLayout.getPeerContainerResourceJid(videoParent[0]);
// Update the large video to the last added video only if there's no // Update the large video to the last added video only if there's no
// current dominant or focused speaker or update it to the current // current dominant, focused speaker or prezi playing or update it to
// dominant speaker. // the current dominant speaker.
if ((!focusedVideoInfo && !VideoLayout.getDominantSpeakerResourceJid()) if ((!focusedVideoInfo &&
|| (parentResourceJid !VideoLayout.getDominantSpeakerResourceJid() &&
&& VideoLayout.getDominantSpeakerResourceJid() !Prezi.isPresentationVisible()) ||
=== parentResourceJid)) { (parentResourceJid &&
VideoLayout.getDominantSpeakerResourceJid() === parentResourceJid)) {
VideoLayout.updateLargeVideo( VideoLayout.updateLargeVideo(
RTC.getVideoSrc(videoelem[0]), RTC.getVideoSrc(videoelem[0]),
1, 1,