Chrome rejects getUserMedia with NotAllowedError (permission denied)
NotAllowedErrorShort answer
NotAllowedError means a layer said no: the user or Chrome's site settings blocked the camera, the operating system blocks Chrome from the device, or a Permissions-Policy header forbids it. Check Chrome's site setting first, then the OS privacy setting, then the response headers.
Fix it fast
1Find out which cause you have
Print the error name and message from the failing call. A NotAllowedError confirms that a permission layer, not a missing device, is the cause.
navigator.mediaDevices.getUserMedia({ video: true, audio: true }) .catch(e => console.log(e.name, e.message));2Match what you see, then jump to its fix
- 1
No prompt appears any more, or the user once chose Never allowChrome has the camera or microphone blocked for this siteFix - 2
Chrome shows allowed, yet the call still fails; Chrome may offer an Open settings linkThe operating system blocks Chrome from the camera or microphoneFix - 3
No prompt at all, and the call rejects at once with NotAllowedError, mostly for embedded pagesA Permissions-Policy header or iframe tag forbids the featureFix
- 1
What does the error look like?
NotAllowedErrorgetUserMedia rejects with a DOMException named NotAllowedErrorgetUserMedia rejects without ever showing a permission prompt
Cause 1 of 3
Chrome has the camera or microphone blocked for this site
1Check
Open Chrome's site settings for Camera and Microphone and look for your site under the list of sites that are not allowed.
Chrome: Settings > Privacy and security > Site settings > Camera2Fix
Reset the site's permission to Allow in the site settings (remove the stored block), then reload and accept the prompt.
Chrome: Settings > Privacy and security > Site settings > Camera
(remove the site from "Not allowed to use your camera", or set it to Allow)3Verify
The site is no longer listed as blocked and getUserMedia resolves after you accept the prompt.
navigator.mediaDevices.getUserMedia({ video: true }).then(s => console.log('ok', s.active));Confirmed by support.google.com
Cause 2 of 3
The operating system blocks Chrome from the camera or microphone
1Check
Open the camera and microphone privacy settings of your operating system and see whether Chrome is switched on. Chrome's own permission dialog can link there with an Open settings option.
(OS privacy settings for Camera and Microphone; the name varies by device)2Fix
Turn Camera or Microphone on for Chrome in the OS settings, then restart Chrome so it picks the change up.
(toggle in the OS privacy settings; the exact name can vary by device)3Verify
After restarting Chrome, run the first-step command and see the stream resolve.
navigator.mediaDevices.getUserMedia({ video: true }).then(s => console.log('ok', s.active));Confirmed by support.google.com
Cause 3 of 3
A Permissions-Policy header or iframe tag forbids the feature
1Check
Read the response headers of the page, and the allow attribute of any iframe that loads it.
curl -sI https://example.com/call | grep -i permissions-policy2Fix
Allow camera and microphone for your own origin in the header, and add allow to the iframe when the page is embedded.
Permissions-Policy: camera=(self), microphone=(self)
<iframe src="https://app.example.com/call" allow="camera; microphone"></iframe>3Verify
Reload the page: a prompt appears and getUserMedia resolves once accepted.
curl -sI https://example.com/call | grep -i permissions-policyConfirmed by developer.mozilla.org
How do I stop it coming back?
- Call getUserMedia from a button click, so the prompt arrives with an obvious reason.
- Catch NotAllowedError and show how to unblock: site settings first, OS settings second.
- Keep the Permissions-Policy header in the same config file as the other security headers.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Related fixes
Back end
navigator.mediaDevices is undefined, so getUserMedia cannot be called
navigator.mediaDevices is undefined
Browsers only expose navigator.mediaDevices on secure pages: HTTPS, localhost or file://.
3 causes, each with a fixBack end
getUserMedia says the requested device was not found
OverconstrainedError
NotFoundError means the browser found no camera or microphone that matches what you asked for.
3 causes, each with a fixBack end
Airflow SSHOperator stops a long script with SSH command timed out
airflow.exceptions.AirflowException: SSH command timed out
SSHOperator waits only 10 seconds for a command by default.
3 causes, each with a fixBack end
Android gets HTML instead of JSON from a PHP API
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
The response body is not JSON.
2 causes, each with a fixBack end
ng serve says it cannot determine the project or target
Cannot determine project for command.
The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.
3 causes, each with a fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fix