Skip to content
Guest
Learn HTML · Course Syllabus Show lessons
Media, Graphics & Data · 8 min read · Beginner

Audio, Video & Captions

Embed native HTML audio and video players with multiple source formats, poster images, preload hints, and accessible WebVTT captions.

What you'll learn

  • Embed native <video> and <audio> players with controls and fallback sources
  • Attach accessible captions and subtitles using <track kind="captions">
  • Follow browser autoplay and preload best practices

HTML lets you play audio and video natively without third-party plugins.

Accessible <video> Structure

<video controls width="640" height="360" poster="preview.jpg" preload="metadata">
  <source src="lesson.webm" type="video/webm" />
  <source src="lesson.mp4" type="video/mp4" />
  <track kind="captions" src="lesson-en.vtt" srclang="en" label="English" default />
  <p>Your browser does not support HTML video. <a href="lesson.mp4">Download MP4</a>.</p>
</video>

Key Attributes to Know

  • controls: Displays native play/pause, volume, scrub bar, and captions menu.
  • preload="metadata": Loads only duration and dimensions until the user clicks play, saving bandwidth.
  • muted + playsinline: Required if you ever use autoplay (browsers block unmuted autoplay).
  • <track kind="captions">: Loads a .vtt (WebVTT) captions file so deaf/hard-of-hearing users and sound-off viewers can follow along.

Fill-in-the-Blank Exercise

Accessible Video Markup

Show native player controls, defer downloading full video bytes, and attach English captions.

<video  preload="">
<source src="intro.mp4" type="video/mp4" />
< kind="captions" src="intro.vtt" srclang="en" label="English" />
</video>

Try It Yourself: Interactive Web Audio Synthesizer + Media UI

Since sandboxed offline previews don’t depend on external video files, try controlling native browser audio playback and inspect the <audio> element structure below:

Native Audio Controls & Web Audio Demo
Live Result
Console Output

No console output yet. Try calling console.log(...) in JS.

Check Your Understanding

Score: 0 / 1

1. Which HTML element attaches WebVTT captions or subtitles to a <video>?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind