In this article, we will learn about the <video> tag in HTML.
- The <video> tag is used to embed video content in a document, such as a movie clip or other video streams.
- The <video> tag contains one or more <source> tags with different video sources. The browser will choose wisely the source of video that will support it.
- The text that we have written between the <video> and </video> tags will only be displayed when the browsers do not support the <video> element.
<video width="400" height="240" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support the video tag. </video>
There is a number of video format but here are three supported video formats in HTML: MP4, WebM, and OGG.
The browser that will support the <video> tag is mentioned below,
Attributes of <video> tag is below,
|autoplay||autoplay||Specifies that the video will start playing as soon as it is ready|
|controls||controls||Specifies that video controls should be displayed (such as a play/pause button etc).|
|height||pixels||Sets the height of the video player|
|loop||loop||Specifies that the video will start over again, every time it is finished|
|muted||muted||Specifies that the audio output of the video should be muted|
|poster||URL||Specifies an image to be shown while the video is downloading, or until the user hits the play button|
|Specifies if and how the author thinks the video should be loaded when the page loads|
|src||URL||Specifies the URL of the video file|
|width||pixels||Sets the width of the video player|
I hope you guys found something useful.