HTML - Video

Overview

Estimated time: 20–30 minutes

Provide multiple sources and captions for maximum compatibility and accessibility.

Example

<video controls width="480" poster="thumb.jpg" preload="metadata">
  <source src="movie.mp4" type="video/mp4">
  <track kind="captions" src="subs.vtt" srclang="en" label="English" default>
  Sorry, your browser does not support the video tag.
</video>

Try it

Common Pitfalls

  • Missing captions for accessibility.
  • Autoplaying with sound.

Exercises

  1. Add a captions track to an existing video and verify it displays.