Media & Capture

Camera & Microphone

Probing…

Camera & Microphone is a web platform capability in the Media & Capture category. Capture live camera and microphone streams. Supported in Chromium 53+, Firefox 36+, and Safari 11+. Requires a secure context (HTTPS or localhost) and a user gesture such as a click or tap.

Secure contextUser gesture

Permission camera: unknown

Try it

Loading demo…

Code

const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true })
videoEl.srcObject = stream

// Enumerate cameras to build a device picker
const cams = (await navigator.mediaDevices.enumerateDevices())
  .filter(d => d.kind === 'videoinput')

// Live mic meter from the audio track
const ctx = new AudioContext()
const analyser = ctx.createAnalyser()
ctx.createMediaStreamSource(stream).connect(analyser)

Browser support

Chromium
53
Firefox
36
Safari
11

Frequently asked questions

Which browsers support Camera & Microphone?

Supported in Chromium 53+, Firefox 36+, and Safari 11+.

Does Camera & Microphone require HTTPS?

Yes. Camera & Microphone needs a secure context, so it only works over HTTPS (or on localhost during development).

What is Camera & Microphone used for?

Capture live camera and microphone streams.

Can I try Camera & Microphone in my browser?

Yes. shwcs.net runs a live Camera & Microphone demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗