HTML video tag

Html <video> tag adds video in a page. Subtitles may also be added in a video. We write the address of the video in the src attribute of video.

Example


 <video src="files/Hummingbird.mp4"  style="width:100%; height:100%;" controls>
 </video>

Try </>

source element

we can also add video in a page using source element. This method is useful when the same video of different types are used. In that case, if one browser does not support one video, then another type of the same video is played.

Example

<video style="width:100%; height:100%;" controls>
  <source src="files/Hummingbird.mp4" type="video/mp4">
  <source src="files/Hummingbird.mkv" type="video/mkv">
 </video>

Try</>

Tag omission

Both opening and closing tags are necessary for the video element.

Global Attributes

All the global attributes are applicable on the video element.

Specific Attributes

AttributesDescription
src Location (address) of the video.
<video src="address of the video"> </video>
poster A type of poster visible before playing the video.
<video src="address of the video" poster="address of the picture"> </video>
autoplay The video plays automatically after the page is loaded. It is a boolean attribute.
<video src="address of video" auoplay> </video>
loop The video seeks back to the start of the video upon reaching at the end.
<video src="URL of video" loop> </video>
muted The audio is muted by default.
<video src="URL or address of video" muted> </video>
controls represents controls of the video such as pause, play, volume control.
<video src="URL or address of video" controls> </video>
width represents the width of the media resource.
<video src="URL or address of video" width="100%"> </video>
height defines the height of the media resource.
<video src="URL or address of video" height="760px"> </video>
crossorigin the element handles crossorigin requests.
preload specifies how much buffering the video needs.


Was this article helpful?

 

Email:

Message:

Get the newsletter