Lesson 10 / 28

Audio & Video

Native media playback without any plugin.

video and audio tags

The controls attribute shows play/pause/volume UI without any JavaScript.

<video controls width="320">
  <source src="movie.mp4" type="video/mp4">
  Your browser doesn't support video.
</video>

<audio controls>
  <source src="song.mp3" type="audio/mpeg">
</audio>

Multiple sources = fallback

Add several <source> tags with different formats — the browser plays the first one it supports.

Quick check: Which attribute shows built-in play/pause controls?

  • autoplay
  • controls
  • loop
Answer

controls — `controls` adds the browser's default playback UI.