* feat(welcome-page): be able to open settings dialog - Create a getter for getting a settings tab's props so the device selection tab can get updated available devices. - Be able to call a function from a tab after it has mounted. This is used for device selection to essentially call enumerateDevices on the welcome page so the device selectors are populated. - Remove event UIEvents.AUDIO_OUTPUT_DEVICE_CHANGED. Instead directly call setAudioOutputDeviceId where possible. - Fix initialization of the audioOutputDeviceId in settings by defaulting the audio output device to the one set in settings. * squash: updateAvailableDevices -> getAvailableDevices, add comment for propsUpdateFunction
80 lines
1.8 KiB
JavaScript
80 lines
1.8 KiB
JavaScript
import JitsiMeetJS from '../lib-jitsi-meet';
|
|
|
|
import {
|
|
SET_AUDIO_INPUT_DEVICE,
|
|
SET_VIDEO_INPUT_DEVICE,
|
|
UPDATE_DEVICE_LIST
|
|
} from './actionTypes';
|
|
|
|
/**
|
|
* Queries for connected A/V input and output devices and updates the redux
|
|
* state of known devices.
|
|
*
|
|
* @returns {Function}
|
|
*/
|
|
export function getAvailableDevices() {
|
|
return dispatch => new Promise(resolve => {
|
|
const { mediaDevices } = JitsiMeetJS;
|
|
|
|
if (mediaDevices.isDeviceListAvailable()
|
|
&& mediaDevices.isDeviceChangeAvailable()) {
|
|
mediaDevices.enumerateDevices(devices => {
|
|
dispatch(updateDeviceList(devices));
|
|
|
|
resolve(devices);
|
|
});
|
|
} else {
|
|
resolve([]);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Signals to update the currently used audio input device.
|
|
*
|
|
* @param {string} deviceId - The id of the new audio input device.
|
|
* @returns {{
|
|
* type: SET_AUDIO_INPUT_DEVICE,
|
|
* deviceId: string
|
|
* }}
|
|
*/
|
|
export function setAudioInputDevice(deviceId) {
|
|
return {
|
|
type: SET_AUDIO_INPUT_DEVICE,
|
|
deviceId
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Signals to update the currently used video input device.
|
|
*
|
|
* @param {string} deviceId - The id of the new video input device.
|
|
* @returns {{
|
|
* type: SET_VIDEO_INPUT_DEVICE,
|
|
* deviceId: string
|
|
* }}
|
|
*/
|
|
export function setVideoInputDevice(deviceId) {
|
|
return {
|
|
type: SET_VIDEO_INPUT_DEVICE,
|
|
deviceId
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Signals to update the list of known audio and video devices.
|
|
*
|
|
* @param {Array<MediaDeviceInfo>} devices - All known available audio input,
|
|
* audio output, and video input devices.
|
|
* @returns {{
|
|
* type: UPDATE_DEVICE_LIST,
|
|
* devices: Array<MediaDeviceInfo>
|
|
* }}
|
|
*/
|
|
export function updateDeviceList(devices) {
|
|
return {
|
|
type: UPDATE_DEVICE_LIST,
|
|
devices
|
|
};
|
|
}
|