HTML <video> Tag: The HTML<video> tag defines a video, movie clip or any other video streams. But after the release of HTML 5, adding a video to a webpage is as easy as adding an image. The HTML5 “video” element specifies a standard way to embed a video in a web page.
HTML <video> Tag
This HTML video tag supports both the global and the event attributes.
Syntax: <video>Text</video>
Attributes
- Autoplay: It tells the browser to immediately start downloading the video and play it as soon as it can.
- Preload: It intends to provide a hint to the browser about what the author thinks will lead to the best user experience.
- Loop: It tells the browser to automatically loop the video.
- height & width: It sets the width and height of the video in CSS pixels.
- Controls: It shows the default video controls like play, pause, volume, etc.
- Muted: It mutes the audio from the video.
- Poster: It loads an image to preview before the loading of the video.
Browser compatibility
The HTML<video> tag is supported by different types of browsers.
- Chrome
- Firefox
- Opera
- Safari
- Internet Explorer
Attributes that are supported by the <video> tag
Attribute | Value | Description |
---|---|---|
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 |