HTML Video



<video>

The <video> element is used to embed and play a video file on a web page.

Syntax:

<video controls width="400">
  <source src="video/sample.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

Output:

Explanation:

controls attribute - adds video controls such as play, pause, volume, and fullscreen.

source element - allows you to add multiple video formats. If the browser cannot play the first file, it will try the next one.

video element - any text placed inside <video>...</video> will appear only if the browser does not support video playback.


Additional Video Attributes

autoplay - plays the video automatically when the page loads.

muted - starts the video with the sound turned off.

loop - makes the video replay continuously.

poster - sets a placeholder image before the video starts playing.

width / height - controls the size of the displayed video.

HTML Logo