Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(video-layout): video layout controls own updating after user leave

Leonard Kim1e3dc20b44c4
diff --git a/conference.js b/conference.js
index 25620a1b04..86576b1baf 100644
--- a/conference.js
+++ b/conference.js
@@ -1713,7 +1713,11 @@ export default {
APP.store.dispatch(participantLeft(id, room));
logger.log('USER %s LEFT', id, user);
APP.API.notifyUserLeft(id);
- APP.UI.removeUser(id, user.getDisplayName());
+ APP.UI.messageHandler.participantNotification(
+ user.getDisplayName(),
+ 'notify.somebody',
+ 'disconnected',
+ 'notify.disconnected');
APP.UI.onSharedVideoStop(id);
});
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index 401b4c0be9..f9518afa75 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -504,18 +504,6 @@ UI.addUser = function(user) {
}
};
-/**
- * Remove user from UI.
- * @param {string} id user id
- * @param {string} displayName user nickname
- */
-UI.removeUser = function(id, displayName) {
- messageHandler.participantNotification(
- displayName, 'notify.somebody', 'disconnected', 'notify.disconnected');
-
- VideoLayout.removeParticipantContainer(id);
-};
-
/**
* Update videotype for specified user.
* @param {string} id user id
diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js
index 459be100f6..c41073dfc5 100644
--- a/modules/UI/shared_video/SharedVideo.js
+++ b/modules/UI/shared_video/SharedVideo.js
@@ -497,7 +497,7 @@ export default class SharedVideoManager {
this.localAudioMutedListener);
this.localAudioMutedListener = null;
- VideoLayout.removeParticipantContainer(this.url);
+ APP.store.dispatch(participantLeft(this.url, APP.conference._room));
VideoLayout.showLargeVideoContainer(SHARED_VIDEO_CONTAINER_TYPE, false)
.then(() => {
@@ -522,8 +522,6 @@ export default class SharedVideoManager {
UIEvents.UPDATE_SHARED_VIDEO, null, 'removed');
});
- APP.store.dispatch(participantLeft(this.url, APP.conference._room));
-
this.url = null;
this.isSharedVideoShown = false;
this.initialAttributes = null;
diff --git a/modules/UI/shared_video/SharedVideoThumb.js b/modules/UI/shared_video/SharedVideoThumb.js
index 3407329483..1301667c2e 100644
--- a/modules/UI/shared_video/SharedVideoThumb.js
+++ b/modules/UI/shared_video/SharedVideoThumb.js
@@ -68,10 +68,6 @@ SharedVideoThumb.prototype.videoClick = function() {
SharedVideoThumb.prototype.remove = function() {
logger.log('Remove shared video thumb', this.id);
- // Make sure that the large video is updated if are removing its
- // corresponding small video.
- this.VideoLayout.updateAfterThumbRemoved(this.id);
-
// Remove whole container
if (this.container.parentNode) {
this.container.parentNode.removeChild(this.container);
diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js
index a62464ab71..0fa98fe43d 100644
--- a/modules/UI/videolayout/RemoteVideo.js
+++ b/modules/UI/videolayout/RemoteVideo.js
@@ -476,10 +476,6 @@ RemoteVideo.prototype.remove = function() {
this.removeRemoteVideoMenu();
- // Make sure that the large video is updated if are removing its
- // corresponding small video.
- this.VideoLayout.updateAfterThumbRemoved(this.id);
-
// Remove whole container
if (this.container.parentNode) {
this.container.parentNode.removeChild(this.container);
diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js
index 1f9cd2529b..33d41a9cec 100644
--- a/modules/UI/videolayout/VideoLayout.js
+++ b/modules/UI/videolayout/VideoLayout.js
@@ -253,7 +253,7 @@ const VideoLayout = {
* Uses focusedID if any or dominantSpeakerID if any,
* otherwise elects new video, in this order.
*/
- updateAfterThumbRemoved(id) {
+ _updateAfterThumbRemoved(id) {
// Always trigger an update if large video is empty.
if (!largeVideo
|| (this.getLargeVideoID() && !this.isCurrentlyOnLarge(id))) {
@@ -804,6 +804,7 @@ const VideoLayout = {
}
VideoLayout.resizeThumbnails();
+ VideoLayout._updateAfterThumbRemoved(id);
},
onVideoTypeChanged(id, newVideoType) {
diff --git a/react/features/video-layout/middleware.web.js b/react/features/video-layout/middleware.web.js
index 00ec129fc4..9a8d5f19a8 100644
--- a/react/features/video-layout/middleware.web.js
+++ b/react/features/video-layout/middleware.web.js
@@ -5,6 +5,7 @@ import UIEvents from '../../../service/UI/UIEvents';
import {
DOMINANT_SPEAKER_CHANGED,
+ PARTICIPANT_LEFT,
PARTICIPANT_UPDATED,
PIN_PARTICIPANT
} from '../base/participants';
@@ -27,6 +28,9 @@ MiddlewareRegistry.register(store => next => action => {
const result = next(action);
switch (action.type) {
+ case PARTICIPANT_LEFT:
+ VideoLayout.removeParticipantContainer(action.participant.id);
+ break;
case PARTICIPANT_UPDATED: {
// Look for actions that triggered a change to connectionStatus. This is