Video Element in HTML5

In HTML5 it is specified by <video> element.

Video element

To play an Video file specific element <video> is used. Between the video tag there <source> is used. Format is given below.

<video>
<source src="xyx.mp4" type="video/mp4">
</video>


Attributes of Video tag.

Sr.No Attribute Description
1 autoplay This attribute is used for automatic starts of video when the browser stop loading.
2 autobuffer This attribute used for automatic starts buffering a video.
3 controls This attribute is used for show and allow the user to use control of the video.
4 loop This attribute is used to allow a video to automatically seek back to the start after reaching at the end.
5 muted This attribute is used to mute the video.
6 width This attribute is used to specify the width of a video.
7 height This attribute is used to specify the height of the video.

The autoplay attribute

<video controls autoplay>
<source src="xyx.mp4" type="video/mp4">
</audio>

Explanation of autoplay attribute

As in above example autoplay attribute is used, this is for video file to start playing automatically when url is loaded.


The autobuffer attribute

<video autobuffer controls>
<source src="xyx.mp4" type="video/mp4">
</video>

Explanation of autobuffer attribute

As in above example autobuffer attribute is used, this is for video file to start buffering automatically when url is loaded.


The controls attribute

<video controls>
<source src="xyx.mp4" type="video/mp4">
</video>

Explanation of controls attribute

As in above example controls attribute is used, this for video file to allow the user to have some controls on the audio file.


The loop attribute

<video controls loop>
<source src="xyx.mp4" type="video/mp4">
</video>

Explanation of loop attribute

As in above example loop attribute is used, this for video file for repetition at some specific point.


The muted attribute

<video controls muted>
<source src="xyx.mp4" type="video/mp4">
</video>

Explanation of muted attribute

As in above example muted attribute is used, this for mute a audio or video file.


The width and height attribute

<video width="210" height="150" controls>
<source src="xyx.mp4" type="video/mp4">
</video>

Explanation of height and width attribute

As in above example height and width attribute is used, this for specify a width and height of a video file.


Video Formats

Sr.No Format Description
1 .avi This is most commonly used in videos but this is not supported in web browsers.
2 .wmv This is same case as in .avi use, but not in web browsers.
3 .mov This is most common video format which is popular in apple devices but supported in web browsers.
4 .ogg This is also a common video format which is supported both in HTML and HTML5.
5 .webm This is another common format in videos which also supported both in HTML and HTML5.
6 .mp4 This is most famous and commonlly used format in videos which most popular in YouTube.









The Best

Comment here

If you have any query, if you want to know something about any of technical course related to computer science field, if you have any suggestion about relevant to uploaded content or if you anything wrong here (any mistake in content) than please contact us. Keep in mind, comment should be according to community guidelines.


ads