Summary -

In this topic, we described about the <video> tag along with detailed example.

The <video> element was introduced in HTML 5. Defines video or movie streams in the HTML document. <video> tag is commonly used to embed video files to web pages.

MP3, Wav and Ogg are the 3 supported file formats for the <vide> element. MP3 format is supported by all browsers.

The URL of the video file can be specified in between the opening and closing tags <video src="" controls></video>.

Any content in between the opening and closing <video> tags is replacement content if browser not supported the <video> tag or <video> format.

Syntax -


Optional Attributes -

autoplaySpecifies the video can be loading and playing will be done automatically.None.
controlsInstructs the web browser to apply browsers in-built set of user controls (to stop, play, mute, etc.).None.
crossoriginUsed to handle Cross Origin Resource Sharing requests in conjunction with JavaScript
loopSpecifies that replay the video once it has finished. None.
mediagroupUsed to group several audio and/or video elements together. Text.
mutedSpecifies that mute the video resource by default.None.
preloadSpecifies the size of the video file should be buffered.none: specifies fetch video data once playback has been appealed.
metadata: Fetch the duration data.
auto: User specification comes before server
srcSpecifies the location of the video file.URL.

Example -

<!DOCTYPE html>
		<title>Track tag example.. </title>
		<video width="360" height="240" controls>
			<source src="video/light.mp4" type="video/mp4">

Output -