fix(large-video): trigger update after timeout for 1-on-1 calls (#1599)
* fix(large-video): trigger update after timeout for 1-on-1 calls Currently no video switch happens if a user joins audio and video muted. For example, User A is in a call and User B joins with no mic and camera. User A will keep seeing local video on large video. The fix is to set a timeout, of a somewhat arbitrary 3 seconds, to show User B on large video. * SQUASH: wrap videoElement access in if * SQUASH: split out remoteVideoActive logic
This commit is contained in:
parent
b7c4ebba84
commit
1da95d2e37
|
@ -435,6 +435,19 @@ var VideoLayout = {
|
||||||
remoteVideo = new RemoteVideo(user, VideoLayout, eventEmitter);
|
remoteVideo = new RemoteVideo(user, VideoLayout, eventEmitter);
|
||||||
this._setRemoteControlProperties(user, remoteVideo);
|
this._setRemoteControlProperties(user, remoteVideo);
|
||||||
this.addRemoteVideoContainer(id, remoteVideo);
|
this.addRemoteVideoContainer(id, remoteVideo);
|
||||||
|
|
||||||
|
const remoteVideosCount = Object.keys(remoteVideos).length;
|
||||||
|
|
||||||
|
if (remoteVideosCount === 1) {
|
||||||
|
window.setTimeout(() => {
|
||||||
|
const updatedRemoteVideosCount
|
||||||
|
= Object.keys(remoteVideos).length;
|
||||||
|
|
||||||
|
if (updatedRemoteVideosCount === 1 && remoteVideos[id]) {
|
||||||
|
this._maybePlaceParticipantOnLargeVideo(id);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -465,11 +478,24 @@ var VideoLayout = {
|
||||||
logger.info(resourceJid + " video is now active", videoElement);
|
logger.info(resourceJid + " video is now active", videoElement);
|
||||||
|
|
||||||
VideoLayout.resizeThumbnails(
|
VideoLayout.resizeThumbnails(
|
||||||
false, false, function() {$(videoElement).show();});
|
false, false, () => {
|
||||||
|
if (videoElement) {
|
||||||
|
$(videoElement).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Update the large video to the last added video only if there's no
|
this._maybePlaceParticipantOnLargeVideo(resourceJid);
|
||||||
// current dominant, focused speaker or update it to
|
},
|
||||||
// the current dominant speaker.
|
|
||||||
|
/**
|
||||||
|
* Update the large video to the last added video only if there's no current
|
||||||
|
* dominant, focused speaker or update it to the current dominant speaker.
|
||||||
|
*
|
||||||
|
* @params {string} resourceJid - The id of the user to maybe display on
|
||||||
|
* large video.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
_maybePlaceParticipantOnLargeVideo(resourceJid) {
|
||||||
if ((!pinnedId &&
|
if ((!pinnedId &&
|
||||||
!currentDominantSpeaker &&
|
!currentDominantSpeaker &&
|
||||||
this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE)) ||
|
this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE)) ||
|
||||||
|
|
Loading…
Reference in New Issue