HTML video - how to use <video> tag

The HTML <video> tag is used to define a video (MP4, Ogg and WebM formats) on a HTML page.

Place text between the start and closing <video> tags that will be rendered in browsers that do not support <video> tag.

Attributes

The video tag supports the global and event attributes.

autoplay
This is a boolean attribute indicating to automatically play the video file.
controls
The presence of this attribute indicates the browser to display controls such as volume, seeking and play / pause.
height
Defines the height of the video player
loop
This is a boolean attribute that when specified will restart playing the video file when completed
muted
This is a boolean attribute that indicates whether the video should be muted when started.
poster
Defines the default image to display that will appear until the video is started
preload
This provides data to the browser on how to best deal with the video file.
Possible values include auto, metadata and none.
src
This indicates the source of the audio file.
width
Defines the width of the video player

Examples:

<!-- set width using CSS pixels--> <!--set initial image by using poster attribute--> <video controls width="640" height="360" poster="image.png"> <source src="video.mp4" /> <source src="video.ogv" /> Browser does not support HTML5 video. </video>

Related HTML tags: