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. * 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. // Reset VideoLayout. It's destroyed in features/video-layout/middleware.web.js so re-initialize it.
VideoLayout.initLargeVideo(); VideoLayout.initLargeVideo();
VideoLayout.resizeVideoArea(); VideoLayout.resizeVideoArea();
// Destroy old tracks. // Restore initial state.
APP.store.dispatch(destroyLocalTracks());
this._localTracksInitialized = false; this._localTracksInitialized = false;
this.isSharingScreen = false;
this.localPresenterVideo = null;
this.roomName = roomName; this.roomName = roomName;
const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks(); const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks(options);
const localTracks = await tryCreateLocalTracks; const localTracks = await tryCreateLocalTracks;
this._displayErrorsForCreateInitialLocalTracks(errors); this._displayErrorsForCreateInitialLocalTracks(errors);

View File

@ -11,9 +11,18 @@ import {
createConference, createConference,
getCurrentConference getCurrentConference
} from '../base/conference'; } from '../base/conference';
import { setAudioMuted, setVideoMuted } from '../base/media'; import {
MEDIA_TYPE,
setAudioMuted,
setVideoMuted
} from '../base/media';
import { getRemoteParticipants } from '../base/participants'; import { getRemoteParticipants } from '../base/participants';
import { createDesiredLocalTracks } from '../base/tracks/actions'; import { createDesiredLocalTracks } from '../base/tracks/actions';
import {
getLocalTracks,
isLocalCameraTrackMuted,
isLocalTrackMuted
} from '../base/tracks';
import { import {
NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TIMEOUT_TYPE,
clearNotifications, clearNotifications,
@ -219,6 +228,10 @@ export function moveToRoom(roomId?: string) {
dispatch(setVideoMuted(video.muted)); dispatch(setVideoMuted(video.muted));
dispatch(createDesiredLocalTracks()); dispatch(createDesiredLocalTracks());
} else { } else {
const localTracks = getLocalTracks(getState()['features/base/tracks']);
const isAudioMuted = isLocalTrackMuted(localTracks, MEDIA_TYPE.AUDIO);
const isVideoMuted = isLocalCameraTrackMuted(localTracks);
try { try {
await APP.conference.leaveRoom(false /* doDisconnect */); await APP.conference.leaveRoom(false /* doDisconnect */);
} catch (error) { } catch (error) {
@ -227,7 +240,10 @@ export function moveToRoom(roomId?: string) {
// TODO: revisit why we don't dispatch CONFERENCE_LEFT here. // TODO: revisit why we don't dispatch CONFERENCE_LEFT here.
} }
APP.conference.joinRoom(_roomId); APP.conference.joinRoom(_roomId, {
startWithAudioMuted: isAudioMuted,
startWithVideoMuted: isVideoMuted
});
} }
if (goToMainRoom) { if (goToMainRoom) {