Content · Web Development · HTML

HTML Media Error Handling and Fallback Experiences

Media Error Handling and Fallback Experiences: The browser may choose a supported source. A transcript outside the video remains readable even when playback fails. Includes a practical HTML example and an explanation.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Adding a picture or video is the easy part. Making it load efficiently and understandable to every visitor is the real goal.

What You Need to Know


A missing media file, unsupported format, or blocked request can make playback fail. Provide useful surrounding text and, when appropriate, a fallback link rather than leaving an empty player.

Try the Example


Take a look at the example. We’ll explain the important lines right below it.

<video controls width="600" poster="images/video-preview.jpg">
    <source src="media/class-lesson.webm" type="video/webm">
    <source src="media/class-lesson.mp4" type="video/mp4">
    <p>This video cannot play here. Read the lesson transcript below.</p>
</video>
<section>
    <h2>Transcript</h2>
    <p>Teacher: Today we will learn how plants grow.</p>
</section>

Let’s Read the Code


  • <video>: The video element creates a video player and can include alternative formats.
  • <source>: A source points to a media file or image choice with a type or other condition.
  • controls: Controls asks the browser to provide its native audio or video player controls.
  • width: Width gives a preferred or intrinsic media width, depending on the element.

What the example shows: The browser may choose a supported source. A transcript outside the video remains readable even when playback fails.

What Happens in the Browser?


The paths shown here refer to files in your own example project. Put real images and recordings in those locations before expecting them to load.

What if the resource is missing? Test the page with the media path temporarily broken. The surrounding text should still explain the important idea, and controls should remain understandable. This is especially important for slow connections and accessibility.

Your Turn


Break a source path on purpose and check whether the transcript still helps.

Common Beginner Mistakes


  • Leaving out real media files or understandable text alternatives.
  • Fallback text inside video is not always visible when a video file fails; provide an external transcript for reliable access.

Key Takeaways


  • A missing media file, unsupported format, or blocked request can make playback fail.
  • <video>: The video element creates a video player and can include alternative formats.
  • If the resource cannot load, users still need enough text to understand what was meant to be there.
Share this resourceSend this page to someone who may find it useful.