HTML Multimedia
HTML Multimedia
HTML supports multimedia elements such as audio, video, and interactive content directly on web pages. These elements enhance user experience by adding sound, video, and other media content.
1. Audio
The <audio> element is used to embed audio files.
Syntax:
Attributes:
| Attribute | Description |
|---|---|
controls |
Shows play/pause/volume controls |
autoplay |
Starts playing automatically |
loop |
Repeats the audio continuously |
muted |
Starts the audio muted |
2. Video
The <video> element is used to embed video files.
Syntax:
Attributes:
| Attribute | Description |
|---|---|
controls |
Shows play/pause/volume controls |
autoplay |
Starts video automatically |
loop |
Loops the video |
muted |
Starts muted |
poster |
Displays an image before video plays |
3. Embed External Multimedia
-
YouTube video using
<iframe>:
-
Other media files like PDFs can be embedded using
<embed>or<object>.
Example HTML Multimedia Page
Key Points
-
Use
<audio>and<video>for native HTML multimedia support. -
Always include multiple source formats (
mp4,webm,ogg) for browser compatibility. -
Use controls attribute to provide user playback options.
-
Multimedia makes web pages interactive and engaging.
