mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-14 14:07:50 +00:00
Move logic to open device selection outside of SettingsMenu so it can be called independently by either SettingsMenu or by the settings button itself if no other settings but devices will be displayed.
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
/* globals APP */
|
|
|
|
import { openDialog } from '../base/dialog';
|
|
import JitsiMeetJS from '../base/lib-jitsi-meet';
|
|
|
|
import { DeviceSelectionDialog } from './components';
|
|
|
|
/**
|
|
* Open DeviceSelectionDialog with a configuration based on the environment's
|
|
* supported abilities.
|
|
*
|
|
* @returns {Function}
|
|
*/
|
|
export function openDeviceSelectionDialog() {
|
|
return (dispatch, getState) => {
|
|
JitsiMeetJS.mediaDevices.isDeviceListAvailable()
|
|
.then(isDeviceListAvailable => {
|
|
const state = getState();
|
|
const conference = state['features/base/conference'].conference;
|
|
|
|
dispatch(openDialog(DeviceSelectionDialog, {
|
|
currentAudioOutputId: APP.settings.getAudioOutputDeviceId(),
|
|
currentAudioTrack: conference.getLocalAudioTrack(),
|
|
currentVideoTrack: conference.getLocalVideoTrack(),
|
|
disableAudioInputChange:
|
|
!JitsiMeetJS.isMultipleAudioInputSupported(),
|
|
disableDeviceChange: !isDeviceListAvailable
|
|
|| !JitsiMeetJS.mediaDevices.isDeviceChangeAvailable(),
|
|
hasAudioPermission: JitsiMeetJS.mediaDevices
|
|
.isDevicePermissionGranted('audio'),
|
|
hasVideoPermission: JitsiMeetJS.mediaDevices
|
|
.isDevicePermissionGranted('video'),
|
|
hideAudioInputPreview:
|
|
!JitsiMeetJS.isCollectingLocalStats(),
|
|
hideAudioOutputSelect: !JitsiMeetJS.mediaDevices
|
|
.isDeviceChangeAvailable('output')
|
|
}));
|
|
});
|
|
};
|
|
}
|