Fix guide · Webcam test
How to fix "OverconstrainedError" for a camera or microphone
OverconstrainedError means a page asked for settings your device cannot provide, such as an exact resolution, frame rate or a specific device ID that no longer exists. The device works, but the request was too strict. As a visitor you fix it by choosing another device or resetting the page. As a developer you relax the constraints.
Quick fix checklist
- 1Reload the page and choose the default camera or microphone instead of a specific one.
- 2Unplug and replug the device, then refresh so the browser lists it again.
- 3Select a different camera or microphone from the device list and test again.
- 4Update the browser, because older versions report resolution limits differently.
- 5If you build the page, use ideal values for width, height and frame rate instead of exact values.
What "constraints" are
A page can pass constraints to getUserMedia: width, height, frameRate, facingMode, deviceId and audio options. The words exact and min make a value mandatory. If no connected device can meet a mandatory value, the browser stops with OverconstrainedError and names the setting that failed in the error.
Typical triggers are asking for 1920 × 1080 from a 720p camera, requesting facingMode environment on a laptop with one camera, or reusing a deviceId saved before the device was unplugged.
How developers should handle it
Prefer ideal over exact, read the error property constraint to see which setting failed, and retry once with simpler constraints. Show the user a device picker rather than failing silently. The webcam test reports the real resolution and frame rate the camera delivers so you can see what is possible.
FAQ
Common questions
What does OverconstrainedError mean?
The camera or microphone could not satisfy a setting the page demanded, such as an exact size or a specific device that is no longer connected.
Why does it appear after I unplug a USB camera?
The page may still request that camera by its saved ID. Pick another device or reload so the page asks for the default device.
Is OverconstrainedError a permission problem?
No. Permission errors are NotAllowedError. This one is about unsupported settings, so the permission prompt may never be the issue.
How do I see what my camera supports?
Run the webcam test and read the resolution and frame rate shown with the live picture.