<video> element is used to embed video content in an HTML document without requiring any additional plugin like Flash player.
Support for the
<video> element varies accross browsers. At the moment, there are three main video formats that is supported for the video element: MP4, Ogg and WebM.
The following table summarizes the usages context and the version history of this tag.
|Start/End Tag:||Start tag: required, End tag: required|
|Version:||New in HTML5|
The basic syntax of the
<video> tag is given with:
The example below shows the
<video> tag in action.
ExampleTry this code »
<video controls="controls" src="shuttle.mp4"> Your browser does not support the HTML5 Video element. </video>
A video, using the browser default set of controls, with alternative sources.
ExampleTry this code »
<video controls="controls"> <source src="shuttle.mp4" type="video/mp4"> <source src="shuttle.ogv" type="video/ogg"> Your browser does not support the HTML5 Video element. </video>
Tip: You can place content such as text or download link inside a video element to provide alternate content in case, if the browser does not support the video content or somehow failed to download the video source file.
The following table shows the attributes that are specific to the
||This Boolean attribute specifies that the video will automatically start playing as soon as it can do so without stopping to finish loading the data.|
||If specified, the browsers will display controls to allow the user to control video playback, such as play/pause, volume, etc.|
||pixels||Sets the height of the video's display area.|
||This Boolean attribute specifies that the video will automatically start over again, upon reaching the end.|
||This Boolean attribute specifies whether the video will be initially silenced. The default value is false, meaning that the audio will be played when the video is played.|
||URL||Specifies an image to be shown while the video is downloading, or until the user hits the play button. If this attribute isn't specified, nothing is displayed until the first frame of the video is available; then the first frame is displayed as the poster.|
||Provides a hint to the browser about whether to download of the video itself or its metadata. The autoplay attribute can override this attribute, because if you want to automatically play a video, the browser will obviously need to download it.|
||URL||Specifies the location of the video file to embed. Alternatively, you can use the preferred
||pixels||Sets the width of the video's display area.|
Like all other HTML tags, the
<video> tag supports the global attributes in HTML5.
<video> tag also supports the event attributes in HTML5.
<video> tag is supported in all major modern browsers.