From e6accd40e11502f40e2331372e8b80e699019e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 10 Dec 2021 14:40:41 +0100 Subject: [PATCH] fix(breakout-rooms) ensure we use the same media types when joining Only audio and video are considered. Screen sharing won't be preserved. --- conference.js | 9 +++++---- react/features/breakout-rooms/actions.js | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/conference.js b/conference.js index 9cdee1acaf..b5357b8924 100644 --- a/conference.js +++ b/conference.js @@ -1333,18 +1333,19 @@ export default { /** * Used by the Breakout Rooms feature to join a breakout room or go back to the main room. */ - async joinRoom(roomName) { + async joinRoom(roomName, options) { // Reset VideoLayout. It's destroyed in features/video-layout/middleware.web.js so re-initialize it. VideoLayout.initLargeVideo(); VideoLayout.resizeVideoArea(); - // Destroy old tracks. - APP.store.dispatch(destroyLocalTracks()); + // Restore initial state. this._localTracksInitialized = false; + this.isSharingScreen = false; + this.localPresenterVideo = null; this.roomName = roomName; - const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks(); + const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks(options); const localTracks = await tryCreateLocalTracks; this._displayErrorsForCreateInitialLocalTracks(errors); diff --git a/react/features/breakout-rooms/actions.js b/react/features/breakout-rooms/actions.js index b6e4e756fd..fed2faa536 100644 --- a/react/features/breakout-rooms/actions.js +++ b/react/features/breakout-rooms/actions.js @@ -11,9 +11,18 @@ import { createConference, getCurrentConference } from '../base/conference'; -import { setAudioMuted, setVideoMuted } from '../base/media'; +import { + MEDIA_TYPE, + setAudioMuted, + setVideoMuted +} from '../base/media'; import { getRemoteParticipants } from '../base/participants'; import { createDesiredLocalTracks } from '../base/tracks/actions'; +import { + getLocalTracks, + isLocalCameraTrackMuted, + isLocalTrackMuted +} from '../base/tracks'; import { NOTIFICATION_TIMEOUT_TYPE, clearNotifications, @@ -219,6 +228,10 @@ export function moveToRoom(roomId?: string) { dispatch(setVideoMuted(video.muted)); dispatch(createDesiredLocalTracks()); } else { + const localTracks = getLocalTracks(getState()['features/base/tracks']); + const isAudioMuted = isLocalTrackMuted(localTracks, MEDIA_TYPE.AUDIO); + const isVideoMuted = isLocalCameraTrackMuted(localTracks); + try { await APP.conference.leaveRoom(false /* doDisconnect */); } catch (error) { @@ -227,7 +240,10 @@ export function moveToRoom(roomId?: string) { // TODO: revisit why we don't dispatch CONFERENCE_LEFT here. } - APP.conference.joinRoom(_roomId); + APP.conference.joinRoom(_roomId, { + startWithAudioMuted: isAudioMuted, + startWithVideoMuted: isVideoMuted + }); } if (goToMainRoom) {