HTML Media
Embed audio and video with appropriate fallbacks.
audio and video embed time-based media with native browser controls. Multiple source elements can offer different formats, track adds captions or descriptions, and fallback content gives people another route when playback is unsupported or inappropriate.
Provide sources and fallback content
The browser checks source elements in order and plays the first supported format. Include the MIME type so it can decide without downloading every file. Text inside audio or video appears when the element is unsupported.
<video controls width="960" poster="html-lesson-poster.jpg" preload="metadata">
<source src="html-lesson.webm" type="video/webm">
<source src="html-lesson.mp4" type="video/mp4">
<track kind="captions" src="html-lesson-en.vtt" srclang="en" label="English" default>
<p><a href="html-lesson.mp4">Download the HTML lesson video</a>.</p>
</video>- Expose native controls.
- Offer well-supported formats.
- Add captions for spoken content and meaningful sounds.
- Use preload=metadata when full preloading is unnecessary.
- Provide a transcript or equivalent when it improves access.
Design captions and transcripts as content
Captions identify speech, important sound effects, and speaker changes. A transcript can make long media searchable and easier to review. Audio descriptions communicate important visual information that dialogue does not cover.