What Is Video Tag in HTML ?

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.

Example

<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.

Browser MP4 WebM Ogg
Edge YES YES YES
Chrome YES YES YES
Firefox YES YES YES
Safari YES YES NO
Opera YES YES YES

The browser that will support the <video> tag is mentioned below,

Browser Version
Chrome 4.0
Internet Explorer 9.0
Firefox 3.5
Safari 3.1
Opera 11.5

Attributes of <video> tag is below,

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
poster URL Specifies an image to be shown while the video is downloading, or until the user hits the play button
preload auto
metadata
none
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.

Thank you.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories