Skip to content

Commit b7a4668

Browse files
committed
Potentially fix audio in and out for devices with only default
1 parent f812159 commit b7a4668

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/av/interface.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,18 @@ export class AVInterface {
876876
console.log('getAVDevices, getUserMedia...', error)
877877
}
878878
}
879-
this.devices = (await navigator.mediaDevices.enumerateDevices()).filter(
880-
(el) => el.deviceId !== 'default' && el.deviceId !== 'communications'
879+
const enumDevices = await navigator.mediaDevices.enumerateDevices()
880+
const unfiltered = {}
881+
enumDevices.forEach((el) => {
882+
if (el.deviceId !== 'default' && el.deviceId !== 'communications') {
883+
// this will not be filtered
884+
unfiltered[el.kind] = (unfiltered[el.kind] || 0) + 1
885+
}
886+
})
887+
this.devices = enumDevices.filter(
888+
(el) =>
889+
(el.deviceId !== 'default' && el.deviceId !== 'communications') ||
890+
!unfiltered[el.kind]
881891
)
882892
return this.devices
883893
}

0 commit comments

Comments
 (0)