Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google chrome DOMException: Permission denied by system for navigator.mediaDevices.getUserMedia

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?

like image 619
Morris Avatar asked Nov 22 '19 19:11

Morris


People also ask

What is navigator MediaDevices getUserMedia?

The MediaDevices . getUserMedia() method prompts the user for permission to use a media input which produces a MediaStream with tracks containing the requested types of media.

Which browsers support getUserMedia?

getUserMedia needs to be prefixed with webkit- or moz-. The first example is only prefixed with webkit-. Therefor it will never work on Firexox, only Chrome and Safari.


1 Answers

Windows 11 - Microphone Privacy Settings fix

From the other solutions it sounds like a variety of issues could be causing this problem. For me (Windows 11, Google Chrome) this issue was caused by my microphone being disabled in my Windows privacy settings.

To fix, click Start and search for "Microphone Privacy Settings". In the control panel that pops up, switch "Microphone access" to on.

like image 131
Alex Crist Avatar answered Oct 10 '22 17:10

Alex Crist