Files
jitsi-meet/react/features/prejoin/components/web/PrejoinApp.tsx
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

102 lines
2.9 KiB
TypeScript

import React, { ComponentType } from 'react';
import { batch } from 'react-redux';
import BaseApp from '../../../base/app/components/BaseApp';
import { getConferenceOptions } from '../../../base/conference/functions';
import { setConfig } from '../../../base/config/actions';
import { createPrejoinTracks } from '../../../base/tracks/functions.web';
import GlobalStyles from '../../../base/ui/components/GlobalStyles.web';
import JitsiThemeProvider from '../../../base/ui/components/JitsiThemeProvider.web';
import DialogContainer from '../../../base/ui/components/web/DialogContainer';
import { setupInitialDevices } from '../../../conference/actions.web';
import { initPrejoin, makePrecallTest } from '../../actions.web';
import PrejoinThirdParty from './PrejoinThirdParty';
type Props = {
/**
* Indicates the style type that needs to be applied.
*/
styleType: string;
};
/**
* Wrapper application for prejoin.
*
* @augments BaseApp
*/
export default class PrejoinApp extends BaseApp<Props> {
/**
* Navigates to {@link Prejoin} upon mount.
*
* @returns {void}
*/
async componentDidMount() {
await super.componentDidMount();
const { store } = this.state;
const { dispatch } = store ?? {};
const { styleType } = this.props;
super._navigate({
component: PrejoinThirdParty,
props: {
className: styleType
}
});
const { startWithAudioMuted, startWithVideoMuted } = store
? store.getState()['features/base/settings']
: { startWithAudioMuted: undefined,
startWithVideoMuted: undefined };
dispatch?.(setConfig({
prejoinConfig: {
enabled: true
},
startWithAudioMuted,
startWithVideoMuted
}));
await dispatch?.(setupInitialDevices());
const { tryCreateLocalTracks, errors } = createPrejoinTracks();
const tracks = await tryCreateLocalTracks;
batch(() => {
dispatch?.(initPrejoin(tracks, errors));
store && dispatch?.(makePrecallTest(getConferenceOptions(store.getState())));
});
}
/**
* Overrides the parent method to inject {@link AtlasKitThemeProvider} as
* the top most component.
*
* @override
*/
_createMainElement(component: ComponentType<any>, props: Object) {
return (
<JitsiThemeProvider>
<GlobalStyles />
{ super._createMainElement(component, props) }
</JitsiThemeProvider>
);
}
/**
* Renders the platform specific dialog container.
*
* @returns {React$Element}
*/
_renderDialogContainer() {
return (
<JitsiThemeProvider>
<DialogContainer />
</JitsiThemeProvider>
);
}
}