/

HTML / CSS / JavaScript Tutorial

HTML Element: <video>

[this page | pdf | back links]

The HTML <video> element indicates a video or movie. It is new in HTML 5. Currently there are 3 supported video formats across most browsers: MP4 (i.e. MPEG 4 files with H264 video codec and AAC audio codec, MIME-type is video/mp4), WebM (i.e. WebM files with V8 video codec and Vorbis audio codec, MIME-type is video/webm) and Ogg (Ogg files with Theora video codec and Vorbis audio codec, MIME-type is video/ogg).

 

If the browser does not support <video> elements then any text between the <video> and </video> tags will be displayed.

 

The attributes it can take (in addition to HTML global attributes and HTML event attributes) are:

 

Attribute

Description

More

autoplay

Specifies whether media should start playing as soon as ready

Here

controls

Whether controls (such as play and pause buttons) should be displayed

Here

height

Height of element

Here

loop

Media to start over again when it finishes

Here

muted

Audio output should be muted

Here

poster

Image to be shown while video is downloading (or until user hits play)

Here

preload

If / how author thinks media should be loaded when page loads

Here

src

URL of media

Here

width

Width of element

Here

 

To create or access such an element in JavaScript see here. The corresponding HTML DOM object supports standard DOM properties and methods, and additional properties with the same name and meaning as the attributes of the underlying HTML element referred to above. It also supports DOM generic media properties and methods and the following additional properties and methods.

 

Additional properties:

 

Property

Description

More

videoTracks

Returns VideoTrackList object indicating available video tracks

Here

 

The default style applicable to this element is shown here.

 


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile