Skip to content

Commit

Permalink
fix(devices): Do not select stored devices that are not available.
Browse files Browse the repository at this point in the history
  • Loading branch information
hristoterezov committed Sep 6, 2024
1 parent d2afd5e commit 0fa02ff
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions react/features/base/settings/functions.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0fa02ff

Please sign in to comment.