Before HTML5, a video could only be played in a browser with a plug-in (like flash).
<video> element specifies a standard way to embed a video in a web page.
The numbers in the table specify the first browser version that fully supports the
To show a video in HTML, use the
controls attribute adds video controls, like play, pause, and volume.
It is a good idea to always include
height attributes. If height and width are not set, the page might flicker while the video loads.
<source> element allows you to specify alternative video files which the browser may choose from. The browser will use the first recognized format.
The text between the
</video> tags will only be displayed in browsers that do not support the
To start a video automatically use the
The autoplay attribute does not work in mobile devices like iPad and iPhone.
In HTML5, there are 3 supported video formats: MP4, WebM, and Ogg.
The browser support for the different formats is:
|Opera||YES (from Opera 25)||YES||YES|
|File Format||Media Type|
HTML5 defines DOM methods, properties, and events for the
This allows you to load, play, and pause videos, as well as setting duration and volume.
There are also DOM events that can notify you when a video begins to play, is paused, etc.
For a full DOM reference, go to our HTML5 Audio/Video DOM Reference.
|<video>||Defines a video or movie|
|<source>||Defines multiple media resources for media elements, such as <video> and <audio>|
|<track>||Defines text tracks in media players|