Browse Source

fix(devices): Do not select stored devices that are not available.

factor2
Hristo Terezov 1 year ago
parent
commit
0fa02ff6ba
1 changed files with 12 additions and 10 deletions
  1. 12
    10
      react/features/base/settings/functions.web.ts

+ 12
- 10
react/features/base/settings/functions.web.ts View File

178
         replacement = ''
178
         replacement = ''
179
     } = options;
179
     } = options;
180
 
180
 
181
-    // If there is no label at all, there is no need to fall back to checking
182
-    // the label for a fuzzy match.
183
-    if (!userSelectedDeviceLabel || !userSelectedDeviceId) {
184
-        return userSelectedDeviceId;
185
-    }
181
+    if (userSelectedDeviceId) {
182
+        const foundMatchingBasedonDeviceId = availableDevices?.find(
183
+            candidate => candidate.deviceId === userSelectedDeviceId);
186
 
184
 
187
-    const foundMatchingBasedonDeviceId = availableDevices?.find(
188
-        candidate => candidate.deviceId === userSelectedDeviceId);
185
+        // Prioritize matching the deviceId
186
+        if (foundMatchingBasedonDeviceId) {
187
+            return userSelectedDeviceId;
188
+        }
189
+    }
189
 
190
 
190
-    // Prioritize matching the deviceId
191
-    if (foundMatchingBasedonDeviceId) {
192
-        return userSelectedDeviceId;
191
+    // If there is no label at all, there is no need to fall back to checking
192
+    // the label for a fuzzy match.
193
+    if (!userSelectedDeviceLabel) {
194
+        return;
193
     }
195
     }
194
 
196
 
195
     const strippedDeviceLabel
197
     const strippedDeviceLabel

Loading…
Cancel
Save