v152 · HTML / Media

Capability elements: <camera> and <microphone>

The <camera> and <microphone> capability elements are declarative, user-activated HTML controls that share the same underlying mechanism as the <usermedia> MVP element, with one key distinction: they are designed to request a single capability. The <camera> element specifically requests video capture, while the <microphone> element specifically requests audio capture. Like the <usermedia> MVP, they embed a browser-controlled, strictly styled UI into the page, ensuring a strong, intentional user signal (a click) before a permission prompt is triggered or a stream is started. The <camera> and <microphone> elements provide a dedicated, semantic HTML control for these single-capability use cases. They maintain the identical security model, strict styling constraints, and built-in permission recovery path as the <usermedia> MVP, but offer a more tailored and ergonomic API for developers who do not need mixed media access.

concepts

  1. Camera Control

    Exercise the semantic camera element and inspect its track/error events.

  2. Microphone Control

    Exercise the microphone element with audio constraints and cancellation handling.

  3. Constraint & Event Console

    Compare both capability elements, exact IDL members, and event lifecycles.

why it shipped

Dedicated browser-controlled camera and microphone elements make media permission requests contextual, semantic, and tied to a genuine user activation.

references