Multimedia means sound, video and animation on a web page. In the past, websites needed plugins like Flash. Today every modern browser plays audio and video with the built-in <audio> and <video> tags.
Ways to add multimedia
Tag Use <video>Play a video file. See HTML5 Video <audio>Play a sound file. See HTML5 Audio <iframe>Embed a video from YouTube or Vimeo. See HTML Iframes <canvas>Draw graphics and games with JavaScript <svg>Sharp vector images and animations
Supported file formats
Type Formats Best choice Video MP4, WebM, Ogg MP4 (H.264) works in all browsers Audio MP3, WAV, Ogg MP3 works in all browsers
Tips for multimedia
Keep files small, because big videos make the page slow. Compress them first. Many visitors use mobile data, so do not start a big video automatically. Browsers block autoplay of sound. Autoplay works only when the video is muted. Add subtitles or a text version for visitors who cannot hear. For long videos use YouTube or Vimeo and embed them, so your server does not carry the load.
Old tags: embed and object
The <embed> and <object> tags were used for plugins like Flash. Flash is dead since 2020, so use video, audio or iframe now.
Summary
Use video and audio for your own files, and iframe for YouTube. MP4 and MP3 are the safest formats.
Congratulations! Chapter Finished. Learn more about the similar topics:
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.