Fixes video switching issue. 'oldSmallVideo' field is no longer used as it is might be overwritten before fadeOut 'complete' callback of #largeVideo is called(and we miss UI update on it).
This commit is contained in:
parent
2545441def
commit
9b4ee7c0c5
|
@ -13,7 +13,6 @@ var currentVideoHeight = null;
|
||||||
var getVideoSize = getCameraVideoSize;
|
var getVideoSize = getCameraVideoSize;
|
||||||
var getVideoPosition = getCameraVideoPosition;
|
var getVideoPosition = getCameraVideoPosition;
|
||||||
var currentSmallVideo = null;
|
var currentSmallVideo = null;
|
||||||
var oldSmallVideo = null;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,22 +235,11 @@ function changeVideo(isVisible) {
|
||||||
|
|
||||||
|
|
||||||
// Only if the large video is currently visible.
|
// Only if the large video is currently visible.
|
||||||
// Disable previous dominant speaker video.
|
|
||||||
if (oldSmallVideo) {
|
|
||||||
oldSmallVideo.enableDominantSpeaker(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable new dominant speaker in the remote videos section.
|
|
||||||
if (currentSmallVideo) {
|
|
||||||
currentSmallVideo.enableDominantSpeaker(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
|
LargeVideo.VideoLayout.largeVideoUpdated(currentSmallVideo);
|
||||||
|
|
||||||
$('#largeVideo').fadeIn(300);
|
$('#largeVideo').fadeIn(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldSmallVideo)
|
|
||||||
oldSmallVideo.showAvatar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var LargeVideo = {
|
var LargeVideo = {
|
||||||
|
@ -290,34 +278,31 @@ var LargeVideo = {
|
||||||
/**
|
/**
|
||||||
* Updates the large video with the given new video source.
|
* Updates the large video with the given new video source.
|
||||||
*/
|
*/
|
||||||
updateLargeVideo: function(resourceJid, forceUpdate) {
|
updateLargeVideo: function (resourceJid, forceUpdate) {
|
||||||
var newSmallVideo = this.VideoLayout.getSmallVideo(resourceJid);
|
var newSmallVideo = this.VideoLayout.getSmallVideo(resourceJid);
|
||||||
console.log('hover in ' + resourceJid + ', video: ', newSmallVideo);
|
console.log('hover in ' + resourceJid + ', video: ', newSmallVideo);
|
||||||
|
|
||||||
if (!LargeVideo.isCurrentlyOnLarge(resourceJid) || forceUpdate) {
|
if (!LargeVideo.isCurrentlyOnLarge(resourceJid) || forceUpdate) {
|
||||||
$('#activeSpeaker').css('visibility', 'hidden');
|
$('#activeSpeaker').css('visibility', 'hidden');
|
||||||
|
|
||||||
if(currentSmallVideo) {
|
var oldSmallVideo = null;
|
||||||
|
if (currentSmallVideo) {
|
||||||
oldSmallVideo = currentSmallVideo;
|
oldSmallVideo = currentSmallVideo;
|
||||||
} else {
|
|
||||||
oldSmallVideo = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSmallVideo = newSmallVideo;
|
currentSmallVideo = newSmallVideo;
|
||||||
var oldJid = null;
|
|
||||||
if(oldSmallVideo)
|
|
||||||
oldJid = oldSmallVideo.peerJid;
|
|
||||||
|
|
||||||
|
var oldJid = null;
|
||||||
|
if (oldSmallVideo)
|
||||||
|
oldJid = oldSmallVideo.peerJid;
|
||||||
if (oldJid !== resourceJid) {
|
if (oldJid !== resourceJid) {
|
||||||
// we want the notification to trigger even if userJid is undefined,
|
// we want the notification to trigger even if userJid is undefined,
|
||||||
// or null.
|
// or null.
|
||||||
this.eventEmitter.emit(UIEvents.SELECTED_ENDPOINT,
|
this.eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, resourceJid);
|
||||||
resourceJid);
|
|
||||||
}
|
}
|
||||||
$('#largeVideo').fadeOut(300,
|
$('#largeVideo').fadeOut(300,
|
||||||
changeVideo.bind($('#largeVideo'), this.isLargeVideoVisible()));
|
changeVideo.bind($('#largeVideo'), this.isLargeVideoVisible()));
|
||||||
} else {
|
} else {
|
||||||
if(currentSmallVideo) {
|
if (currentSmallVideo) {
|
||||||
currentSmallVideo.showAvatar();
|
currentSmallVideo.showAvatar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,26 @@ var VideoLayout = (function (my) {
|
||||||
return LargeVideo.getResourceJid();
|
return LargeVideo.getResourceJid();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when large video update is finished
|
||||||
|
* @param currentSmallVideo small video currently displayed on large video
|
||||||
|
*/
|
||||||
|
my.largeVideoUpdated = function (currentSmallVideo) {
|
||||||
|
// Makes sure that dominant speaker UI
|
||||||
|
// is enabled only on current small video
|
||||||
|
localVideoThumbnail.enableDominantSpeaker(
|
||||||
|
localVideoThumbnail === currentSmallVideo);
|
||||||
|
Object.keys(remoteVideos).forEach(
|
||||||
|
function (resourceJid) {
|
||||||
|
var remoteVideo = remoteVideos[resourceJid];
|
||||||
|
if (remoteVideo) {
|
||||||
|
remoteVideo.enableDominantSpeaker(
|
||||||
|
remoteVideo === currentSmallVideo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
my.handleVideoThumbClicked = function(noPinnedEndpointChangedEvent,
|
my.handleVideoThumbClicked = function(noPinnedEndpointChangedEvent,
|
||||||
resourceJid) {
|
resourceJid) {
|
||||||
if(focusedVideoResourceJid) {
|
if(focusedVideoResourceJid) {
|
||||||
|
|
Loading…
Reference in New Issue