HTML Multimedia


Lesson 20 of 58

Multimedia is anything you can hear or see. Images, music, videos, animations, and recordings all count as multimedia. Modern websites use multimedia to engage visitors and deliver rich experiences.


A Brief History

The first web browsers could only show text. One font, one color, no images. Then browsers evolved to support colors, then images, then sound, then video. Today, you can embed high-quality video and audio directly into your web pages.


Multimedia Formats

Multimedia files have different formats, identified by their file extension. For example, .mp3 for audio, .mp4 for video, .jpg for images.

Not every format works in every browser. Some formats like AVI and WMV were designed for Windows but do not work directly in web browsers. Other formats like MP4 and WebM are supported everywhere.

Tip: For video, use MP4. It works in all modern browsers and is recommended by YouTube and other major platforms.

Common Video Formats

Format Extension Browser Support
MP4 .mp4 ✅ All browsers (recommended)
WebM .webm ✅ All modern browsers
Ogg .ogg ✅ All modern browsers
AVI .avi ❌ Not supported in web browsers
WMV .wmv ❌ Not supported in web browsers
QuickTime .mov ❌ Not supported in web browsers
Note: Only MP4, WebM, and Ogg video formats are officially supported by the HTML standard. MP4 is your safest choice.

Common Audio Formats

Format Extension Browser Support
MP3 .mp3 ✅ All browsers (recommended)
MP4 / AAC .mp4 / .aac ✅ All browsers
WAV .wav ✅ All browsers (large file size)
Ogg .ogg ✅ All modern browsers
MIDI .mid ❌ Not supported in web browsers
WMA .wma ❌ Not supported in web browsers
Tip: For audio, use MP3. It is small, high quality, and works everywhere. For the best compatibility, you can provide multiple formats using the <source> element.

How to Add Video to Your Website

We will learn the actual HTML tags for video and audio in the next chapters. For now, just know that MP4 is your best choice for video, and MP3 is your best choice for audio.

Here is a preview of what you will learn:

Video Tag Preview
Tip: Always include the controls attribute so users can play and pause the video. Without controls, the video is invisible and cannot be played.

How to Add Audio to Your Website

Here is a preview of the audio tag:

Audio Tag Preview

Notice how we provide both an OGG and an MP3 source. The browser picks the first format it can play.


Summary of Best Practices

  • For video: Use MP4 format (.mp4). It works in all modern browsers.
  • For audio: Use MP3 format (.mp3). It works in all modern browsers.
  • Always include controls so users can play, pause, and adjust volume.
  • Provide multiple sources if you want maximum compatibility (but MP4 and MP3 alone are usually enough).
  • Consider file size. Large videos take time to load and use data. Compress your videos before uploading.

What Just Happened? Let Me Explain

  • Not all multimedia formats work on the web. Some formats like AVI and WMV were designed for desktop software, not browsers.
  • The HTML standard only guarantees support for MP4, WebM, Ogg (video) and MP3, WAV, Ogg (audio).
  • MP4 is the safest choice for video because it is supported everywhere and has good compression.
  • MP3 is the safest choice for audio because it is supported everywhere and has good compression.
  • You can host video files on your own server, or you can embed videos from YouTube, Vimeo, or ModafVibe using iframes.
Tip: If you have large video files, consider using a video hosting service like YouTube or Vimeo. They handle the streaming and compression for you. You can then embed the video on your page with a simple code snippet.

HTML Multimedia Reference

Format Use For Recommended?
MP4 Video ✅ Yes (best choice)
WebM Video Good alternative
MP3 Audio ✅ Yes (best choice)
WAV Audio Good but large files
AVI, WMV, MOV Video ❌ Not for web

Lesson 20 of 58