HTML Video

A video on a Web page will be shown through the HTML video element.

It is also used for video tag playback speed, video tag codepen, video tag youtube, video tag autoplay not working, video tag supported formats, video tag in react, video html code, video html template, video html responsive.

The HTML <video> Element

Use the video element to display an HTML video:

Example

<video width="400" controls>
  <source src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4" type="video/mp4" />
  Sorry, your browser doesn't support embedded videos!
</video>

<p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>

Result of the above code is:



Video courtesy of Big Buck Bunny.



The HTML <video> - Multiple Sources

Here we are providing 3 different sources for the media; this allows the video to be watched regardless of which video codecs are supported by the browser.

Example

<!-- Using multiple sources as fallbacks for a video tag -->
<!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
<!-- Poster hosted by Wikimedia -->
<video width="620" controls
  poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg" >
  <source src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4" type="video/mp4">
  <source src="https://archive.org/download/ElephantsDream/ed_hd.ogv" type="video/ogg">
  <source src="https://archive.org/download/ElephantsDream/ed_hd.avi" type="video/avi">
  Your browser doesn't support HTML5 video tag.
</video>

Result of the above code is:


It is also used for video element react, video element events, video element properties, video element controls, video element angular, video element autoplay, video element attributes and example, video element typescript, video volume and play, loop, preload, video player codepen.

How it Works

Video controls such as play, pause, and volume, are added with the controls property.

Always include width and height properties in your code. The website may flicker while the video loads if the height and width are not specified.

You may use the source element to specify other video files for the browser to pick from. The browser will use the first format it recognizes.

Only browsers that do not support the video element will see the text between the video and /video tags.

It is also used for how does html video tag work, html to add video in html, html video not playing.

HTML <video> Autoplay and Muted

Use the autoplay element to start a video automatically. In most circumstances, Chromium browsers do not support autoplay, Muted autoplay, on the other hand, is always permitted.

Add muted to allow the video to play automatically after auto playback (but muted):

Example

<video width="400" controls>
  <source src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4" type="video/mp4" />
  Sorry, your browser doesn't support embedded videos!
</video>

<p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>

Result of the above code is:

Video courtesy of Big Buck Bunny.


It is also used for video html autoplay not working and autoplay false, autoplay loop no controls, autoplay with sound, autoplay off, autoplay loop muted.

HTML Video Formats

There are three supported video formats: MP4, WebM, and Ogg. The browser support for the different formats is:

Browser MP4 WebM Ogg
Edge YES YES YES
Chrome YES YES YES
Firefox YES YES YES
Safari YES YES NO
Opera YES YES YES
It is used for video formats compatibility and support, video formats file format, video format play format, video format type, video player for all formats in html, convert html to video formats.

HTML Video - Media Types

File Format Media Type
MP4 video/mp4
WebM video/webm
Ogg video/ogg
It is used for video media query, video media fragments, video media types, video media attribute, video media group, video source media attribute, video source media query not working.

HTML Video - Methods, Properties, and Events

For the video element, the HTML DOM sets methods, attributes, and events.

You may load, play, and break videos and control duration and volume.

DOM events may also tell you whenever a video starts playing, stops, and so on.

It is also used for video play method, video stop method, video player properties, video dom currenttime property, video event listeners and event ended, event playing, event load, event error, stop event, pause event, fullscreen event, seek event.