HTML Element <video> Example
The HTML element <video>
is used to embed a video into an HTML document.
The video formats supported by most browsers are MP4, OGG, and WebM.
- The MP4 video file will have a
.mp4
file extension. - The OGG video file will have a
.ogg
file extension. - The WebM video file will have a
.webm
file extension.
Here is an example that explains the element in action. Click the below link to see the live demo.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example - HTML Element video</title>
</head>
<body>
<h2>HTML Video</h2>
<video width="400" height="300" controls src="/assets/videos/movie.mp4">
Oops!! Your browser does not support video element.
You can download the video from <a href="https://www.randomcodez.com/downloads">here</a>.
</video>
<h2>HTML Video with alternate video formats</h2>
<video width="400" height="300" controls>
<source src="/assets/videos/movie.mp4" type="video/mp4">
<source src="/assets/videos/movie.webm" type="video/webm">
<source src="/assets/videos/movie.ogg" type="video/ogg">
Oops!! Your browser does not support video element.
</video>
</body>
</html>