8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6469d5 commit c424f98Copy full SHA for c424f98
packages/core/useDevicesList/index.ts
@@ -86,6 +86,11 @@ export function useDevicesList(options: UseDevicesListOptions = {}): UseDevicesL
86
if (state.value !== 'granted') {
87
let granted = true
88
try {
89
+ const allDevices = await navigator!.mediaDevices.enumerateDevices()
90
+ const hasCamera = allDevices.some(device => device.kind === 'videoinput')
91
+ const hasMicrophone = allDevices.some(device => device.kind === 'audioinput' || device.kind === 'audiooutput')
92
+ constraints.video = hasCamera ? constraints.video : false
93
+ constraints.audio = hasMicrophone ? constraints.audio : false
94
stream = await navigator!.mediaDevices.getUserMedia(constraints)
95
}
96
catch {
0 commit comments