HTML <video> tag

HTML <video> tag : Definition

The HTML Video element (<video>) embeds a media player which supports video playback into the document. You can use <video> for audio content as well, but the <audio> element may provide a more appropriate user experience.

The <video> tag was introduced in HTML 5 (officially referred to as HTML5 - without the space). HTML5 video is now widely implemented in the major browsers and it has support from major websites such as YouTube.



video tag example:

Output:


Note: The video tag is not supported in Internet Explorer 8 and earlier versions.

Video tag Specific Attributes


The following table shows the attributes that are specific to the <video> tag.

Attribute Value Description
autoplay autoplay This Boolean attribute specifies that the video will automatically start playing as soon as it can do so without stopping to finish loading the data.
controls controls If specified, the browsers will display controls to allow the user to control video playback, such as play/pause, volume, etc.
height pixels Sets the height of the video's display area.
loop loop This Boolean attribute specifies that the video will automatically start over again, upon reaching the end.
muted muted This Boolean attribute specifies whether the video will be initially silenced. The default value is false, meaning that the audio will be played when the video is played.
poster URL Specifies an image to be shown while the video is downloading, or until the user hits the play button. If this attribute isn't specified, nothing is displayed until the first frame of the video is available; then the first frame is displayed as the poster.
preload auto
metadata
none
Provides a hint to the browser about whether to download of the video itself or its metadata. The autoplay attribute can override this attribute, because if you want to automatically play a video, the browser will obviously need to download it.
src URL Specifies the location of the video file to embed. Alternatively, you can use the preferred <source> tag as it allows for multiple options.
width pixels Sets the width of the video's display area.