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(devices): Do not select stored devices that are not available.

Hristo Terezov0fa02ff6baff
diff --git a/react/features/base/settings/functions.web.ts b/react/features/base/settings/functions.web.ts
index a3753c97b3..71423cafbb 100644
--- a/react/features/base/settings/functions.web.ts
+++ b/react/features/base/settings/functions.web.ts
@@ -178,18 +178,20 @@ function _getUserSelectedDeviceId(options: {
replacement = ''
} = options;
- // If there is no label at all, there is no need to fall back to checking
- // the label for a fuzzy match.
- if (!userSelectedDeviceLabel || !userSelectedDeviceId) {
- return userSelectedDeviceId;
- }
+ if (userSelectedDeviceId) {
+ const foundMatchingBasedonDeviceId = availableDevices?.find(
+ candidate => candidate.deviceId === userSelectedDeviceId);
- const foundMatchingBasedonDeviceId = availableDevices?.find(
- candidate => candidate.deviceId === userSelectedDeviceId);
+ // Prioritize matching the deviceId
+ if (foundMatchingBasedonDeviceId) {
+ return userSelectedDeviceId;
+ }
+ }
- // Prioritize matching the deviceId
- if (foundMatchingBasedonDeviceId) {
- return userSelectedDeviceId;
+ // If there is no label at all, there is no need to fall back to checking
+ // the label for a fuzzy match.
+ if (!userSelectedDeviceLabel) {
+ return;
}
const strippedDeviceLabel