PUBLISHED ON: FEBRUARY 23, 2021
HTML Video Tag
HTML helps us to add multimedia files on your website by providing various multimedia elements like audio, video, embed, and object.
-
In HTML, the <video>
tag is used to embed a video or a movie clip in a document.
-
There are three file-format that is supported by <video>
tag with their MIME-Type and these are given below:-
File-Format
|
MIME_TYPE
|
MP4
|
video/mp4
|
WebM
|
video/webm
|
ogg
|
video/ogg
|
-
The content inside the opening and closing <video></video>
tags are shown as a fallback in browsers that don't support the <video> tag.
-
If you don't specify the controls
attribute, the video won't include the browser's default controls; you can create your own custom controls using JavaScript.
-
Also, this is a Block-Level Element.
HTML <video>
Tag Syntax and Usage
The <video>
element requires the start(opening) tag and end(closing) tag.
The basic syntax for the same is given below:
<video>
....content here
</video>
HTML <video>
Tag Attribute
HTML <video>
tag supports both global and event attributes and some of the common attributes are given below:
1. Buffered
This attribute is used to determine the time ranges of buffered media.
2. Src
This attribute is used to specify the URL for the video.
3. Width
This attribute is used to set the width of the video on a Web Page.
4. Controls
This attribute is used for displaying the video controls like pause/play buttons on a web page.
5. Height
This attribute is used to specify the height of the video in pixels in an HTML document.
6. Autoplay
Autoplay is a boolean attribute; if it is specified, then the video automatically begins to playback as soon as it can do so without stopping to finish loading the data.
7. Loop
It is a boolean attribute and is used to replay the audio files.
8. Preload
This attribute is used to specify how the video should be loaded when the page loads It has three values: auto, metadata, none.
HTML <video>
Tag Basic Example
Below we have a basic example to show the usage of <video>
tag:
Browser Support for HTML<video>
Tag
-
Google Chrome 4.0
-
Internet Explorer 9.0
-
Firefox 3.5
-
Opera Mini 10.5