Attributes and usage of


The HTML5 <audio> and <video> tags make it simple to add media to a website. You need to set src attribute to identify the media source and include a controls attribute so the user can play and pause the media.

The HTML5 video tag can have a number of attributes to control the look and feel and various functionalities of the control:

sr. No.Attribute & Description
1Autoplay

This boolean attribute if specified, the video will automatically begin to play back as soon as it can do so without stopping to finish loading the data.
2Autobuffer

This boolean attribute if specified, the video will automatically begin buffering even if it's not set to automatically play.
3Controls

If this attribute is present, it will allow the user to control video playback, including volume, seeking, and pause/resume playback.
4Height

This attribute specifies the height of the video's display area, in CSS pixels.
5Loop

This boolean attribute if specified, will allow video automatically seek back to the start after reaching at the end.
6Preload
This attribute specifies that the video will be loaded at page load, and ready to run. Ignored if autoplay is present.
7Poster

This is a URL of an image to show until the user plays or seeks.
8Src

The URL of the video to embed. This is optional; you may instead use the <source> element within the video block to specify the video to embed
9Width

This attribute specifies the width of the video's display area, in CSS pixels.

Updated on: 29-Jan-2020

447 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements