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

Misc: source, track

video

for embedding video file.

audio

for embedding audio file.

source

Used inside video or audio tags.

track

Used with video and audio tag, for things like subtitle.

HTML Video and Audio Tags