← HTML Fundamentals
Links, images and media · 15 MIN

Audio and video

Audio and video

The audio and video elements provide native playback. Include controls so users can operate media, provide fallback text and captions for video when speech or meaningful sound is present. Avoid autoplaying sound.

Try it yourself

Change the example, run it, and explain the result in your own words. Then create one variation of your own.

Key idea

Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.

Code example

<video controls width="640" poster="preview.jpg">
  <source src="lesson.mp4" type="video/mp4">
  <track kind="captions" src="captions.vtt" srclang="en" label="English">
</video>