HTML Media Guide
HTML Media Overview
HTML provides several elements for embedding and controlling media, including video, audio, and external plugins. This guide will cover the basics of these elements and how to use them effectively.
HTML Video
The <video>
element is used to embed video content in a web page. It supports various video formats and includes controls for play, pause, and volume.
<video width="640" height="360" controls>
<source src="video.mp4" type="video/mp4">
<source src="video.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
Example of embedding a video:
HTML Audio
The <audio>
element is used to embed audio content. It also supports multiple formats and includes controls for playback.
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
<source src="audio.ogg" type="audio/ogg">
Your browser does not support the audio element.
</audio>
Example of embedding audio:
HTML Plug-Ins
HTML no longer widely uses plugins like Flash
, but the <embed>
and <object>
elements are used to embed external resources:
<embed src="plugin.swf" width="400" height="300">
<object data="plugin.swf" width="400" height="300">
<param name="movie" value="plugin.swf">
Your browser does not support the object element.
</object>
Example of embedding a plugin (e.g., Flash content):
Embedding YouTube Videos
To embed YouTube videos, use the <iframe>
element. This allows you to display videos directly from YouTube on your page.
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
Example of embedding a YouTube video:
0 Comments