Switches to the last visible video correctly when current speaker leaves the conference.
This commit is contained in:
parent
03902de511
commit
4aa6fbc4b9
|
@ -546,23 +546,10 @@ function onMucMemberLeft(jid) {
|
|||
if(!config.startAudioMuted ||
|
||||
config.startAudioMuted > APP.members.size())
|
||||
UIUtil.playSoundNotification('userLeft');
|
||||
// Need to call this with a slight delay, otherwise the element couldn't be
|
||||
// found for some reason.
|
||||
// XXX(gp) it works fine without the timeout for me (with Chrome 38).
|
||||
window.setTimeout(function () {
|
||||
var container = document.getElementById(
|
||||
'participant_' + Strophe.getResourceFromJid(jid));
|
||||
if (container) {
|
||||
|
||||
ContactList.removeContact(jid);
|
||||
VideoLayout.removeConnectionIndicator(jid);
|
||||
// hide here, wait for video to close before removing
|
||||
$(container).hide();
|
||||
VideoLayout.resizeThumbnails();
|
||||
}
|
||||
}, 10);
|
||||
|
||||
VideoLayout.participantLeft(jid);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -205,6 +205,12 @@ function updateActiveSpeakerAvatarSrc() {
|
|||
}
|
||||
|
||||
function changeVideo(isVisible) {
|
||||
|
||||
if (!currentSmallVideo) {
|
||||
console.error("Unable to change large video - no 'currentSmallVideo'");
|
||||
return;
|
||||
}
|
||||
|
||||
updateActiveSpeakerAvatarSrc();
|
||||
|
||||
APP.RTC.setVideoSrc($('#largeVideo')[0], currentSmallVideo.getSrc());
|
||||
|
|
|
@ -119,7 +119,8 @@ var VideoLayout = (function (my) {
|
|||
var newResourceJid;
|
||||
// We'll show user's avatar if he is the dominant speaker or if
|
||||
// his video thumbnail is pinned
|
||||
if (resourceJid === focusedVideoResourceJid ||
|
||||
if (remoteVideos[resourceJid] &&
|
||||
resourceJid === focusedVideoResourceJid ||
|
||||
resourceJid === currentDominantSpeaker) {
|
||||
newResourceJid = resourceJid;
|
||||
} else {
|
||||
|
@ -137,18 +138,20 @@ var VideoLayout = (function (my) {
|
|||
var videoElem = RTC.getVideoElementName();
|
||||
var pick = $('#remoteVideos>span[id!="mixedstream"]:visible:last>' + videoElem);
|
||||
if (pick.length && APP.RTC.getVideoSrc(pick[0])) {
|
||||
return VideoLayout.getPeerContainerResourceJid(pick[0].parentNode);
|
||||
jid = VideoLayout.getPeerContainerResourceJid(pick[0].parentNode);
|
||||
} else {
|
||||
console.info("Last visible video no longer exists");
|
||||
pick = $('#remoteVideos>span[id!="mixedstream"]>' + videoElem);
|
||||
if (pick.length && APP.RTC.getVideoSrc(pick[0])) {
|
||||
return VideoLayout.getPeerContainerResourceJid(pick[0].parentNode);
|
||||
jid = VideoLayout.getPeerContainerResourceJid(pick[0].parentNode);
|
||||
} else {
|
||||
// Try local video
|
||||
console.info("Fallback to local video...");
|
||||
return APP.xmpp.myResource();
|
||||
jid = APP.xmpp.myResource();
|
||||
}
|
||||
}
|
||||
console.info("electLastVisibleVideo: " + jid);
|
||||
return jid;
|
||||
};
|
||||
|
||||
my.onRemoteStreamAdded = function (stream) {
|
||||
|
@ -784,14 +787,6 @@ var VideoLayout = (function (my) {
|
|||
remoteVideos[resourceJid].updateStatsIndicator(percent, object);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the connection
|
||||
* @param jid
|
||||
*/
|
||||
my.removeConnectionIndicator = function (jid) {
|
||||
remoteVideos[Strophe.getResourceFromJid(jid)].removeConnectionIndicator();
|
||||
};
|
||||
|
||||
/**
|
||||
* Hides the connection indicator
|
||||
* @param jid
|
||||
|
@ -819,6 +814,23 @@ var VideoLayout = (function (my) {
|
|||
console.info("Focused video owner has left the conference");
|
||||
focusedVideoResourceJid = null;
|
||||
}
|
||||
|
||||
if (currentDominantSpeaker === resourceJid)
|
||||
{
|
||||
console.info("Dominant speaker has left the conference");
|
||||
currentDominantSpeaker = null;
|
||||
}
|
||||
|
||||
var remoteVideo = remoteVideos[resourceJid];
|
||||
if (remoteVideo) {
|
||||
remoteVideo.removeConnectionIndicator();
|
||||
// Remove remote video
|
||||
delete remoteVideos[resourceJid];
|
||||
} else {
|
||||
console.warn("No remote video for " + resourceJid);
|
||||
}
|
||||
|
||||
VideoLayout.resizeThumbnails();
|
||||
};
|
||||
|
||||
my.onVideoTypeChanged = function (jid) {
|
||||
|
|
Loading…
Reference in New Issue