HTML multimedia is how you put sound and video into a page using native tags—mainly <audio> and <video>—instead of plugins.
What is the shared media model?
Both elements share the same media engine in the browser (HTMLMediaElement). Attributes such as controls, muted, loop, and preload, plus script methods like play() and pause(), work the same way on audio and video.
What belongs on an HTML page?
Put the media element in your markup, point it at a file with src or nested <source> tags, and give users a way to play (controls or custom buttons). Use <track> for captions, and <iframe> when the video is hosted elsewhere (YouTube, Vimeo).
When should you use native media vs embeds?
Host your own files with audio / video when you need full control of formats, posters, and captions. Use an iframe when a platform already hosts and streams the clip.
Always offer controls.
Native controls (or an accessible custom UI) let visitors play, pause, and change volume. Autoplay with sound is usually blocked.
Muted autoplay only.
If you need background motion, use autoplay muted playsinline. Never assume loud autoplay will start.
Tag pages vs this hub.
Deep attribute lists live on audio and video. This page shows how multimedia fits together on an HTML page.
Syntax
HTML Syntax
Minimal patterns for audio, video, captions, and a page-script control:
HTML
<audio controls>
<source src="sound.mp3" type="audio/mpeg">
Your browser does not support audio.
</audio>
HTML
<video width="640" height="360" controls poster="thumb.jpg">
<source src="clip.webm" type="video/webm">
<source src="clip.mp4" type="video/mp4">
<track kind="subtitles" src="en.vtt" srclang="en" label="English">
Your browser does not support video.
</video>
JS
var media = document.getElementById("demo");
media.play(); // returns a Promise
media.pause();
media.currentTime = 0;
media.muted = true;
Reference
Core HTML Concepts
Building blocks of multimedia on a page:
Element / idea
Role on the page
<audio>
Sound-only media
<video>
Moving picture (+ optional sound)
<source>
Alternate formats; browser picks the first it can play
<track>
Subtitles / captions (WebVTT)
<iframe>
Hosted players (YouTube, Vimeo, …)
HTMLMediaElement
Shared API behind audio and video
Shared media attributes
Attribute
Meaning
controls
Show the browser’s play / seek / volume UI
src
Single media URL (or use nested source)
muted
Start silent (needed for many autoplay cases)
loop
Replay when the clip ends
autoplay
Try to start automatically (often blocked with sound)
preload
none | metadata | auto
poster
Image shown before video plays (video only)
Useful media methods & state
API
Use from a page script
play() / pause()
Start or stop playback (play() returns a Promise)
currentTime
Read or seek position (seconds)
duration
Length in seconds (after metadata loads)
muted / volume
Silence or set loudness (0–1)
paused / ended
Read-only playback state
Events
play, pause, ended, timeupdate, error, …
Approach
How to Add Multimedia to an HTML Page
A simple workflow from markup to playback:
Choose audio or video (or an iframe for hosted video).
Provide one or more source files with correct type MIME values.
preload="metadata" loads duration without downloading the whole file.
controls still lets the user stop the loop.
These attributes map to the shared media element model.
Example 3 — Basic Video
HTML
<video width="640" height="360" controls>
<source src="flower.webm" type="video/webm">
<source src="flower.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
width / height reserve layout space before the first frame.
controls expose play, seek, and volume on the page.
Example 4 — Video with Poster
HTML
<video width="640" height="360" controls poster="thumbnail.jpg">
<source src="flower.webm" type="video/webm">
Your browser does not support the video tag.
</video>
One HTML document can mix native media and embeds.
Headings label each media block for structure.
Native tags use your files; iframe uses a host.
Try It opens the full editable page.
Edge Cases & Pitfalls
Most media bugs are autoplay policy, missing formats, or inaccessible players.
autoplay
Sound blocked on autoplay
Use muted for decorative video, or wait for a user gesture before play().
format
Only one file format
Offer at least MP4 (video) / MP3 (audio) plus a modern alternative when you can.
a11y
No captions for speech
Add a track WebVTT file for spoken content; describe iframe embeds with title.
layout
Layout jump when video loads
Set dimensions or aspect-ratio CSS, and consider a poster.
cors
Cross-origin media limits
Some script features need proper CORS headers on the media host.
promise
Ignoring play() rejection
play() returns a Promise—catch failures so your UI can fall back to a Play button.
Compatibility
Browser Support
Native audio and video (HTMLMediaElement) are Baseline and available in all modern browsers. Always provide fallback text and multiple sources when formats differ.
✓ Baseline · Widely available
Native HTML media
audio, video, source, and track work across current browsers without plugins.
100%audio / video
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
HTML media elementsUniversal
Bottom line: Use controls, offer solid formats, and treat autoplay with muted as the safe default for decorative video.
Remember
Key Takeaways
audio and video are the native HTML way to embed media.
Shared attributes (controls, muted, loop) come from the media element model.
One line: Put media in HTML with audio/video (or iframe), give users controls, and use the shared media API only when you need custom play/pause.
Frequently Asked Questions
HTML multimedia means putting sound and video into a web page with native tags—mainly audio and video—plus helpers like source, track, and iframe for hosted players. No Flash or plugins are required in modern browsers.
HTMLMediaElement is the shared browser interface behind both audio and video. Attributes like controls, muted, and loop, plus methods like play() and pause(), come from that shared media model.
Use audio for sound only. Use video when you need a picture (with optional sound). Both share the same media attributes and can use multiple source children for formats.
Browsers often block autoplay with sound. Prefer muted autoplay for decorative video, or let the user press play with controls. Never depend on autoplay always working.
Put a track element inside video with kind="subtitles" (or captions), srclang, label, and a WebVTT (.vtt) file. Users can enable tracks from the browser controls.
Use an iframe with the embed URL from Share → Embed. Add a descriptive title and allowfullscreen. Hosted iframes are separate from native audio/video files on your server.