简体   繁体   中英

navigator.mediaDevices.getUserMedia Error “DOMException”

Microphone permission granted.

I get the error "DOMException" without any detailed description when I try to run this code await navigator.mediaDevices.getUserMedia({audio: true}) .

Even in console< when I run this code navigator.mediaDevices.getUserMedia({audio:true}) .then(stream => video.srcObject = stream) .catch(e => console.error(e)); I get an error "DOMException".

Why does this happen, what do I need to do?

Js, Vue.js, Chrome, MacOS Mojave.

example in console

MacOS Mojave has specific permissions for the camera in System Preferences. I was running into the same problem until I granted Chrome permission to use the camera. (same for audio)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM