Skip to content

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

fix(conference) simplify code

Saúl Ibarra Corretgé43647f130287
diff --git a/conference.js b/conference.js
index 80601314d5..9dd284b0ac 100644
--- a/conference.js
+++ b/conference.js
@@ -9,6 +9,7 @@ import { ENDPOINT_TEXT_MESSAGE_NAME } from './modules/API/constants';
import { AUDIO_ONLY_SCREEN_SHARE_NO_TRACK } from './modules/UI/UIErrors';
import AuthHandler from './modules/UI/authentication/AuthHandler';
import UIUtil from './modules/UI/util/UIUtil';
+import VideoLayout from './modules/UI/videolayout/VideoLayout';
import mediaDeviceHelper from './modules/devices/mediaDeviceHelper';
import Recorder from './modules/recorder/Recorder';
import { createTaskQueue } from './modules/util/helpers';
@@ -1329,6 +1330,10 @@ export default {
* Used by the Breakout Rooms feature to join a breakout room or go back to the main room.
*/
async joinRoom(roomName) {
+ // Reset VideoLayout. It's destroyed in features/video-layout/middleware.web.js so re-initialize it.
+ VideoLayout.initLargeVideo();
+ VideoLayout.resizeVideoArea();
+
this.roomName = roomName;
const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks();
@@ -2884,7 +2889,7 @@ export default {
Promise.all([
requestFeedbackPromise,
- this.leaveRoomAndDisconnect()
+ this.leaveRoom()
])
.then(values => {
this._room = undefined;
@@ -2905,27 +2910,23 @@ export default {
/**
* Leaves the room.
*
+ * @param {boolean} doDisconnect - Wether leaving the room should also terminate the connection.
* @returns {Promise}
*/
- leaveRoom() {
- if (room && room.isJoined()) {
- return room.leave();
- }
- },
-
- /**
- * Leaves the room and calls JitsiConnection.disconnect.
- *
- * @returns {Promise}
- */
- leaveRoomAndDisconnect() {
+ leaveRoom(doDisconnect = true) {
APP.store.dispatch(conferenceWillLeave(room));
if (room && room.isJoined()) {
- return room.leave().then(disconnect, disconnect);
+ return room.leave().finally(() => {
+ if (doDisconnect) {
+ return disconnect();
+ }
+ });
}
- return disconnect();
+ if (doDisconnect) {
+ return disconnect();
+ }
},
/**
diff --git a/react/features/breakout-rooms/actions.js b/react/features/breakout-rooms/actions.js
index f39725589e..d684f6e45a 100644
--- a/react/features/breakout-rooms/actions.js
+++ b/react/features/breakout-rooms/actions.js
@@ -199,7 +199,7 @@ export function moveToRoom(roomId?: string) {
dispatch(setAudioMuted(audio.muted));
dispatch(setVideoMuted(video.muted));
} else {
- APP.conference.leaveRoom()
+ APP.conference.leaveRoom(false /* doDisconnect */)
.finally(() => APP.conference.joinRoom(_roomId));
}
};
diff --git a/react/features/video-layout/middleware.web.js b/react/features/video-layout/middleware.web.js
index af9c229bea..fc8296fdf4 100644
--- a/react/features/video-layout/middleware.web.js
+++ b/react/features/video-layout/middleware.web.js
@@ -15,8 +15,6 @@ import { PARTICIPANTS_PANE_CLOSE, PARTICIPANTS_PANE_OPEN } from '../participants
import './middleware.any';
-declare var APP: Object;
-
/**
* Middleware which intercepts actions and updates the legacy component
* {@code VideoLayout} as needed. The purpose of this middleware is to redux-ify