The HTML <video> element is used to display video content on a webpage.
<video controls>
<source
src="video.mp4"
type="video/mp4"
>
</video>Important Attributes
| Attribute | Description |
|---|---|
controls | Displays video controls |
autoplay | Starts video automatically |
muted | Starts video without sound |
loop | Repeats video |
width | Specifies video width |
height | Specifies video height |
poster | Displays an image before playback |
<video
width="600"
controls >
<source
src="video.mp4"
type="video/mp4"
>
Your browser does not support the video element.
</video>Video with Poster Image
<video
width="600"
controls
poster="thumbnail.jpg" >
<source
src="video.mp4"
type="video/mp4"
>
</video>Autoplay Video
Modern browsers generally require autoplay videos to be muted.
<video
width="600"
autoplay
muted
loop >
<source
src="video.mp4"
type="video/mp4"
>
</video>