<video> tag
The <video> tag can be used if you want the video to appear on the web page.The controls attribute let you add video controls, like play, pause, and volume.
The <source> tag associated with this tag let you specify alternative video formats. Browser will play the video file which is been recognized firstly among the formats specified. .mp4 is the most commonly recognized video format by the several browsers.
It has following attributes:
Attributes | Description | Values |
---|---|---|
height : | Set the height of the window for video to be appear. | pixels |
width : | Sets the width of the window in pixels or percentage of available screen resolution. | pixels |
name : | Provides label for embedded object. | text |
autoplay : | Sets whether the media element should start automatically or not. | true or false |
loop : | Allows you to have the movie play continuously. true-plays forever from start to end false-pays once palindrome-plays forever forwards and backwards | true, false or palindrome |
controls: | Specifies whether you want the media controller bar to be shown or not. | true or false |
Attributes | Description | Values |
---|---|---|
src : | URL of the video file. | URL |
type : | file format of the video file. | Video/mp4, Video/WebM, Video/ogg |
Now let see the eg.
<video height="315" width="420" controls="true" autoplay="true" loop="true" >
<source src="flower.mp4" type="video/mp4">
<source src="flower.ogg" type="video/ogg">
</video>
Output:
<audio > tag
This tag can be used to play an audio in the HTML file.The controls attribute let you add audio controls, like play, pause, and volume.
The <source> tag associated with this tag let you specify alternative audio formats. Browser will play the audio file which is been recognized firstly among the formats specified. .mp3 is the most commonly recognized audio format by the several browsers.
It takes following attributes :
Attributes | Description | Values |
---|---|---|
name : | Provides label for embedded object. | text |
autoplay : | Sets whether the media element should start automatically or not. | true or false |
loop : | Allows you to have the movie play continuously. true-plays forever from start to end false-pays once palindrome-plays forever forwards and backwards | true, false or palindrome |
controls: | Specifies whether you want the media controller bar to be shown or not. | true or false |
<audio controls loop="2" >
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
</audio >
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
</audio >
0 comments