fix(breakout-rooms) ensure we use the same media types when joining

Only audio and video are considered. Screen sharing won't be preserved.
This commit is contained in:
Saúl Ibarra Corretgé 2021-12-10 14:40:41 +01:00 committed by Saúl Ibarra Corretgé
parent 7f0cfed981
commit e6accd40e1
2 changed files with 23 additions and 6 deletions

View File

@ -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);

View File

@ -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) {