Skip to content

Errors and permissions

Camera failures are ordinary and expected: permission denied, no camera, camera already in use. The component classifies each one so an application can respond without parsing message text.

Live Idle
Ready

Provoke a failure

An unknown DeviceId is requested as an exact constraint, so browsers reject it with OverconstrainedError, which the component reports as ConstraintsUnsatisfied.

RequestedWidth and RequestedHeight are sent as ideal constraints, so an unreachable resolution is negotiated down rather than refused; resolution alone never produces an error.

To see a permission denial, block camera access for this site in the browser and press Start normally.

Current state

No error.

Error kinds

Every failure reaches OnError as a BbScannerException whose Kind is one of these.

KindMeaning
PermissionDeniedThe user or a policy refused the camera.
NoCameraNo device matched the request.
CameraUnavailableA device exists but is held by something else.
ConstraintsUnsatisfiedNo camera can meet the requested constraints.
NotSupportedNo camera API, or the page is not a secure context.
UnknownAnything the browser did not classify.

Secure context

Browsers only expose getUserMedia over HTTPS or on localhost. Served any other way the component reports NotSupported immediately, with a message that says exactly that, instead of hanging on a permission prompt that will never appear.

An unhandled error has occurred. Reload 🗙