HTML CSS Javascript jQuery AJAX PHP Java MORE
Need a Website Or Web Application Or Any Help.Contact Us: +91 9437911966 (Whatsapp) Note: Paid Service

HTML Video With Example

To play video in HTML 5 we can use the <video> element. <video> element is introduced in HTML 5 before that audio files could only be played in a browser with a plug-in (like flash).

HTML 5 support three file format, these are MP4, OGG or webm.

HTML Video Attribute:

Autoplay: autoplay attribute is used to play an audio automatically .

	<!DOCTYPE html>
	<html>
	<head>
		<title>video autoplay</title>
	</head>
	<body>
	   <video src="" width="460" height="330" autoplay >Sorry your browser does not support embedding videos.</video>
	</body>
	</html>

Run it yourself

Controls: The controls attribute is used to provide video controls, like play, pause, and volume..

	<!DOCTYPE html>
	<html>
	<head>
		<title>video controls</title>
	</head>
	<body>
	   <video src="" width="460" height="330" controls>Sorry your browser does not support embedding videos.</video>
	</body>
	</html>

Run it yourself

Loop: It is used to play an audio again and again.

	<!DOCTYPE html>
	<html>
	<head>
		<title>video autoplay loop</title>
	</head>
	<body>
	   <video src="" width="460" height="330" autoplay loop>Sorry your browser does not support embedding videos.</video>
	</body>
	</html>

Run it yourself

Muted: To mute the audio muted attribute is used.

	<!DOCTYPE html>
	<html>
	<head>
		<title>video controls muted</title>
	</head>
	<body>
	   <video src="" width="460" height="330" controls muted>Sorry your browser does not support embedding videos.</video>
	</body>
	</html>

Run it yourself

Src: Specifies the file path of the video.

	<SOURCE>
<video controls>
    <source src=".mp3" type="audio/mp3">
	<source src=".avi" type="audio/avi">
	Sorry your browser does not support embedding audios.
</video>

Run it yourself

Width: Specify the width of the video.