---
url: "https://web.dev/articles/getusermedia-intro"
titulek: "Capture audio and video in HTML5 | Articles | web.dev"
h1: "Capture audio and video in HTML5 Stay organized with collections Save and categorize content based on your preferences."
popis: ""
jazyk: "en"
kanonicka: "https://web.dev/articles/getusermedia-intro"
drobecky: ["Articles", "Capture audio and video in HTML5"]
zdroj: "live"
wayback_snapshot: ""
stazeno: "2026-09-14 00:57:03"
znaku: 10395
slov: 1412
kodovani: "iso-8859-2"
sha256: "f9dd629048b85326a4db7da28c54dd3315371c90849f37813404623f713667e7"
---
Capture audio and video in HTML5
Stay organized with collections
Save and categorize content based on your preferences.
Eric Bidelman
Sam Dutton
Introduction Audio/Video capture has been *the* "Holy Grail" of web development for a long time.
For many years we've had to rely on browser plugins ([Flash](http://www.kevinmusselman.com/2009/02/access-webcam-with-flash/) or
[Silverlight](http://www.silverlightshow.net/items/Capturing-the-Webcam-in-Silverlight-4.aspx))
to get the job done. [Come on!](https://www.youtube.com/watch?v=SP_9zH9Q44o) HTML5 to the rescue. It might not be apparent, but the rise of HTML5 has brought
a surge of access to device hardware. [Geolocation](https://caniuse.com/?search=geolocation) (GPS),
the [Orientation API](https://caniuse.com/screen-orientation) (accelerometer), [WebGL](https://caniuse.com/?search=webgl) (GPU),
and the [Web Audio API](https://caniuse.com/?search=webgl) (audio hardware) are perfect examples. These features
are ridiculously powerful, exposing high level JavaScript APIs that sit
on top of the system's underlying hardware capabilities. This tutorial introduces a new API, [GetUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia), which allows
web apps to access a user's camera and microphone. The road to getUserMedia() If you're not aware of its history, the way we arrived at the `getUserMedia()` API is an interesting tale. Several variants of "Media Capture APIs" have evolved over the past few years.
Many folks recognized the need to be able to access native devices on the web, but
that led everyone and their mom to put together a new spec. Things got
so messy that the W3C finally decided to form a working group. Their sole purpose?
Make sense of the madness! The [Device APIs Policy (DAP) Working Group](http://www.w3.org/2009/dap/)
has been tasked to consolidate + standardize the plethora of proposals. I'll try to summarize what happened in 2011⌠Round 1: HTML Media Capture [HTML Media Capture](http://dev.w3.org/2009/dap/camera/) was the DAP's first go at
standardizing media capture on the web. It works by overloading the ``
and adding new values for the `accept` parameter. If you wanted to let users take a snapshot of themselves with the webcam,
that's possible with `capture=camera`: `` Recording a video or audio is similar: `
` Kinda nice right? I particularly like that it reuses a file input. Semantically,
it makes a lot of sense. Where this particular "API" falls short is the ability to do realtime effects
(e.g. render live webcam data to a `