HTML: Video Tag

By Xah Lee. Date: . Last updated: .

HTML Video Tag

Code

<video src="../SpecialPlaneCurves_dir/Astroid_dir/i/astroid_4_roll_circle_JN7wM.mp4#t=4.5" controls loop></video>

Browser shows

Specifying Multiple Video Formats

If you have multiple video formats, you can use the “source” tag. Browser will pick the one it understands or most suitable. Example:

<video controls>
  <source src="mymovie.ogg" type="video/ogg">
  <source src="mymovie.mp4" type="video/mp4">
  Your browser does not support the video element.
</video>

Video Tag Optional Attributes

Boolean attributes

these do not take any value. just their presence indicate true/false.

controls

Show control panel.

autoplay

Start to play automatically.

loop

Loop playback.

Other attributes

preload

none, metadata, auto

width

value is integer, in pixels

height

value is integer, in pixels

poster

e.g. poster="image.jpg"

Video Formats Browser Support

video format support 2020-04-30
format/browserChromeSafariFirefoxEdge
.mp4yesyesyesyes
.webmyesnoyesyes
.mkvyesnonoyes

HTML Video and Audio Tags