Fix "Default" mic display
This commit is contained in:
parent
4b8c85eec1
commit
0d87e3e6c9
1 changed files with 8 additions and 4 deletions
|
@ -28,18 +28,22 @@ export function findBestMatchingAudioDeviceIndex(
|
|||
return preferred.index;
|
||||
}
|
||||
|
||||
// Number of default devices at start of list to ignore.
|
||||
const offset = isWindows ? 2 : 1;
|
||||
const searchArr = available.slice(offset);
|
||||
|
||||
if (preferred.uniqueId) {
|
||||
const idMatchIndex = available.findIndex(
|
||||
const idMatchIndex = searchArr.findIndex(
|
||||
d => d.uniqueId === preferred.uniqueId
|
||||
);
|
||||
if (idMatchIndex !== -1) {
|
||||
return idMatchIndex;
|
||||
return idMatchIndex + offset;
|
||||
}
|
||||
}
|
||||
|
||||
const nameMatchIndex = available.findIndex(d => d.name === preferred.name);
|
||||
const nameMatchIndex = searchArr.findIndex(d => d.name === preferred.name);
|
||||
if (nameMatchIndex !== -1) {
|
||||
return nameMatchIndex;
|
||||
return nameMatchIndex + offset;
|
||||
}
|
||||
|
||||
return available.length > 0 ? 0 : undefined;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue