Share
How It Works
To show a video in HTML5, this is all you need:
<video src="movie.ogg" controls="controls">
</video>
The control attribute is for adding play, pause, and volume controls.
It is also always a good idea to include the width and height attributes.
Insert content between the <video> and </video> tags for browsers that do not support the video element:
<video src="movie.ogg" width="320" height="240" controls="controls">
Your browser does not support the video tag.
The example above uses an Ogg file, and will work in Firefox, Opera and Chrome.
To make the video work in Safari, the video file must be of type MPEG4.
The video element allows multiple source elements. Source elements can link to different video files. The browser will use the first recognized format:
<video width="320" height="240" controls="controls">
<source src="movie.ogg" type="video/ogg" />
<source src="movie.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>