HTML media tags let browsers play video clips, podcasts, and sound effects directly inside a web page without legacy plugins like Flash. Modern browsers decode standardized media formats natively using hardware acceleration and built-in accessibility controls.
Four semantic tags power web multimedia:
video: Embeds video streams with playback controls, poster thumbnails, and responsive sizing.audio: Embeds music, voice clips, or podcast episodes with native play, seek, and volume controls.source: Lists multiple encoded file formats inside video or audio so each browser selects the best format it supports.track: Attaches WebVTT (.vtt) caption and subtitle files for deaf users and muted playback viewers.<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Media Overview</title>
</head>
<body style="font-family: system-ui, sans-serif; padding: 20px;">
<h2>Native HTML5 Media Players</h2>
<video controls width="480" poster="/images/video-poster.webp" preload="metadata">
<source src="/media/sample-video.mp4" type="video/mp4">
<source src="/media/sample-video.webm" type="video/webm">
<track src="/media/captions-en.vtt" kind="captions" srclang="en" label="English" default>
Your browser does not support HTML5 video playback.
</video>
<div style="margin-top: 16px;">
<audio controls preload="metadata">
<source src="/media/sample-audio.mp3" type="audio/mpeg">
<source src="/media/sample-audio.ogg" type="audio/ogg">
Your browser does not support HTML5 audio playback.
</audio>
</div>
</body>
</html>
MP4 (H.264 video + AAC audio) and WebM (VP9 or AV1) cover virtually every desktop and mobile browser. For audio, MP3 and AAC offer universal support alongside open Opus/Ogg streams. Always set preload="metadata" instead of preload="auto" so browsers do not waste mobile data downloading entire video files before the user clicks play.
autoplay with sound to protect user experience. Pair autoplay with muted and playsinline for background loops.The browser moves down the list of nested source elements in order and plays the first codec it supports, or displays the fallback text.
No. All modern browsers render HTML5 video and audio natively without installing external plugins.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With
Experiment with the code from this lesson in our interactive playground.