---
url: "https://web.dev/articles/media-recording-video"
titulek: "Recording Video from the User | Articles | web.dev"
h1: "Recording Video from the User Stay organized with collections Save and categorize content based on your preferences."
popis: "Most browsers can get access to the user's camera."
jazyk: "en"
kanonicka: "https://web.dev/articles/media-recording-video"
drobecky: ["Articles", "Recording Video from the User"]
zdroj: "live"
wayback_snapshot: ""
stazeno: "2026-09-13 23:12:34"
znaku: 8927
slov: 1406
kodovani: "iso-8859-2"
sha256: "3cfb8dc4382619c3a6c17a7a7fdf87e606348b14eb2cf5450c65bba13b95e4c6"
---
Recording Video from the User
Stay organized with collections
Save and categorize content based on your preferences.
Mat Scales
Many browsers now have the ability to access video and audio input from the
user. However, depending on the browser it might be a full dynamic and inline
experience, or it could be delegated to another app on the user's device. Start simple and progressively The easiest thing to do is simply ask the user for a pre-recorded file. Do this by creating a simple
file input element and adding an `accept` filter that indicates we can only accept video files and
a `capture` attribute that indicates we want to get it direct from the camera. `` This method works on all platforms. On desktop it will prompt the user to upload a file from the
file system (ignoring the `capture` attribute). In Safari
on iOS it will open up the camera app, allowing you to record video and
then send it back to the web page; on Android it will give the user the
choice of which app to use record the video in before sending it back to the web
page. Many mobile devices have more than one camera. If you have a preference, you can set the `capture`
attribute to `user`, if you want the camera that faces the user, or `environment` if you want the
camera that faces outward. `
` Note that this is just a hint - if the browser doesn't support the option, or the camera type you
ask for isn't available, the browser may choose another camera. Once the user has finished recording and they are back in the website, you
need to somehow get ahold of the file data. You can get quick access by
attaching an `onchange` event to the input element and then reading
the `files` property of the event object. `
` Once you have access to the file you can do anything you want with it. For
example, you can: Attach it directly to a `