Files
jitsi-meet/react/features/conference/actions.web.ts
Horatiu Muresan 7f21075613 fix(media-devices) Fix configuring media devices on init (#14097)
- on 3rd party prejoin, we did not setup the initial devices, resulting in always creating tracks for default device for camera and mic regardless of settings, and for both meeting and 3rd party prejoin to not set the audio output device at all
2023-11-24 17:48:43 +02:00

69 lines
2.0 KiB
TypeScript

import { IStore } from '../app/types';
import { configureInitialDevices, getAvailableDevices } from '../base/devices/actions.web';
import { openDialog } from '../base/dialog/actions';
import { getBackendSafeRoomName } from '../base/util/uri';
import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
import LeaveReasonDialog from './components/web/LeaveReasonDialog.web';
import logger from './logger';
/**
* Opens {@code LeaveReasonDialog}.
*
* @param {string} [title] - The dialog title.
*
* @returns {Promise} Resolved when the dialog is closed.
*/
export function openLeaveReasonDialog(title?: string) {
return (dispatch: IStore['dispatch']): Promise<void> => new Promise(resolve => {
dispatch(openDialog(LeaveReasonDialog, {
onClose: resolve,
title
}));
});
}
/**
* Dismisses calendar notification about next or ongoing event.
*
* @returns {Object}
*/
export function dismissCalendarNotification() {
return {
type: DISMISS_CALENDAR_NOTIFICATION
};
}
/**
* Setups initial devices. Makes sure we populate availableDevices list before configuring.
*
* @returns {Promise<any>}
*/
export function setupInitialDevices() {
return async (dispatch: IStore['dispatch']) => {
await dispatch(getAvailableDevices());
await dispatch(configureInitialDevices());
};
}
/**
* Init.
*
* @returns {Promise<JitsiConnection>}
*/
export function init() {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const room = getBackendSafeRoomName(getState()['features/base/conference'].room);
// XXX For web based version we use conference initialization logic
// from the old app (at the moment of writing).
return dispatch(setupInitialDevices()).then(
() => APP.conference.init({
roomName: room
}).catch((error: Error) => {
APP.API.notifyConferenceLeft(APP.conference.roomName);
logger.error(error);
}));
};
}