Google chrome DOMException: Permission denied by system for navigator.mediaDevices.getUserMedia
Solution 1
Since MacOS Mojave, camera and microphone require OS permissions.
This applies to all non-Apple products, including all browsers other than Safari.
Check System Preferences > Security & Privacy > Privacy > Camera & Microphone. Make sure Chrome is listed and has a checkbox.
You should have gotten a special OS prompt about this the first time Chrome tried to access them. But if it accidentally got blocked somehow, you won't ever be prompted again.
Solution 2
In my case, I did not realize the project I was working in was adding a security header, blocking the possibility of microphone use:
Feature-Policy "microphone 'none'; geolocation 'none'"
Solution 3
In my case, this error was occurring for me even though the site in question did not appear under blocked sites on the microphone setting page.
I had to go to Site Settings -> View Permissions and Data stored across all sites -> Find my Site -> Click Reset Permissions to fix the issue.
Related videos on Youtube
Morris
Updated on June 04, 2022Comments
-
Morris almost 2 years
It's November of 2019, this JavaScript code works in FireFox (70.0.1 (64-bit)), Safari (13.0.2 (15608.2.30.1.1)), Opera (Version:65.0.3467.48), On a Windows Chrome Version 70.0.3538.77 (64-bit), this code works. but NOT in MacOS Google Chrome (Version 78.0.3904.108 (Official Build) (64-bit)):
navigator .mediaDevices .getUserMedia({video: true, audio: true}) .then(stream => { console.log("success!") }) .catch(e => { console.log("e: ", e); });
In Chrome's console, I got: DOMException: Permission denied After much googling, I haven't found anything up to date. How exactly do we use JS to request camera access in Chrome?
-
teg_brightly over 4 yearsIf I specifically set the site's camera settings to "Block", I get the same exception. It should be set to "Ask".
-
teg_brightly over 4 yearsHave you checked this: github.com/webrtc/samples/issues/1191 Also does this page ask for a microphone? webrtc.github.io/samples/src/content/getusermedia/audio
-
-
Nitin almost 3 yearsit helped it me! and I have remove mcrophone key from header!