Kodokon kodokon.com

Media: audio, video, figure and figcaption

Embed sound, video and captioned illustrations without any plugin.

8 min · 3 questions

Open this lesson in Kodokon

HTML plays audio and video natively: no external player needed. Real-world use cases: a podcast episode on a blog, a product demo on a landing page, a tutorial embedded in documentation. Let's see how to do it properly.

HTML
<video controls width="640" poster="preview.jpg">
  <source src="demo.webm" type="video/webm">
  <source src="demo.mp4" type="video/mp4">
  <track src="subs-fr.vtt" kind="subtitles"
         srclang="fr" label="French" default>
  Your browser doesn't support HTML5 video.
</video>
A video with fallback formats and subtitles.

Three professional takeaways. The source elements are tried in order: the browser plays the first one it can decode. The poster attribute shows a placeholder image before playback. Finally, track adds subtitles in WebVTT format: essential for accessibility and much appreciated for silent viewing.

HTML
<audio controls preload="metadata">
  <source src="podcast-ep12.mp3" type="audio/mpeg">
  <a href="podcast-ep12.mp3">Download the episode</a>
</audio>
An audio player with a downloadable fallback link.

To illustrate content, figure pairs a media element with its caption via figcaption. And not just images: a chart, a code snippet or a quote are also good candidates. The caption is linked to the figure programmatically, something a plain paragraph below the image can't offer.

HTML
<figure>
  <img src="chart-sales.png"
       alt="Sales up 12% in Q2 2026">
  <figcaption>
    Sales trend, second quarter of 2026.
  </figcaption>
</figure>
An image and its caption, semantically linked.

Knowledge check

Make sure you remember the key points of this lesson.

  1. Why place several source elements inside a video tag?
    • To play all the videos one after another
    • So the browser picks the first format it knows how to play
    • To speed up downloading in parallel
  2. Which attribute displays the play, pause and volume buttons on a video player?
    • controls
    • poster
    • preload
    • muted
  3. What is the role of figcaption?
    • Replacing the image's alt attribute
    • Providing a visible caption, semantically linked to its figure
    • Showing a tooltip when hovering over the image