Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix: getCurrentDevices call from external api (#17410)

Fabian26550af7e103
diff --git a/react/features/device-selection/functions.web.ts b/react/features/device-selection/functions.web.ts
index 775bcb7352..56c6e19575 100644
--- a/react/features/device-selection/functions.web.ts
+++ b/react/features/device-selection/functions.web.ts
@@ -181,27 +181,30 @@ export function processExternalDeviceRequest( // eslint-disable-line max-params
audioOutput: undefined,
videoInput: undefined
};
- const currentlyUsedDeviceIds = new Set([
- getAudioOutputDeviceId(),
- settings.micDeviceId ?? getUserSelectedMicDeviceId(state),
- settings.cameraDeviceId ?? getUserSelectedCameraDeviceId(state)
- ]);
+
+ const audioOutputDeviceId = getAudioOutputDeviceId();
+ const audioInputDeviceId = settings.micDeviceId ?? getUserSelectedMicDeviceId(state);
+ const videoInputDeviceId = settings.cameraDeviceId ?? getUserSelectedCameraDeviceId(state);
devices.forEach(device => {
const { deviceId, kind } = device;
- if (currentlyUsedDeviceIds.has(deviceId)) {
- switch (kind) {
- case 'audioinput':
+ switch (kind) {
+ case 'audioinput':
+ if (deviceId === audioInputDeviceId) {
deviceDescriptions.audioInput = device;
- break;
- case 'audiooutput':
+ }
+ break;
+ case 'audiooutput':
+ if (deviceId === audioOutputDeviceId) {
deviceDescriptions.audioOutput = device;
- break;
- case 'videoinput':
+ }
+ break;
+ case 'videoinput':
+ if (deviceId === videoInputDeviceId) {
deviceDescriptions.videoInput = device;
- break;
}
+ break;
}
});