The browser won't open the camera

  • JavaScript
  • Webcam

You may see

NotAllowedError: Permission denied
NotFoundError: Requested device not found
NotReadableError: Could not start video source
Cannot read properties of undefined (reading 'getUserMedia')

Why it happens

  • undefined: the page isn't on https or localhost.
  • NotAllowedError: you pressed Block.
  • NotReadableError: another app has the camera.
  • NotFoundError: there's no camera.

How to fix it

  1. Run python -m http.server 8000 in the folder and open http://localhost:8000.
  2. Click the icon at the left of the address and allow the camera.
  3. Close Zoom, Meet and other tabs.

It worked if: You see yourself on the page.

From the official documentation. Error names and the https rule from MDN. Sources: MDN: getUserMedia.

Didn't help? Search another error or ask us.