Articles → HTML 5 → Video Tag In Html5

Video Tag In Html5






Purpose





Syntax


<video controls or autoplay>
	<source src=" " type=" " />
	<source src=" " type=" " />
</video>




  1. You can either mention controls or Autoplay attributes in the video tag
    1. Controls attribute adds controls like play, pause, and volume
    2. The Autoplay attribute plays the video automatically when the page gets loaded
  2. Source tag is used to mention the video path in the ‘src’ attribute and the supporting media format in the ‘type’ attribute. You can add as many source tags inside the video tag as many you want. HTML 5 will take the first video that is supported by the browser and play it

Example




<!DOCTYPE html>
<html lang="en">
	<head>
		<title></title>
	</head>
	<body>
		<video controls>
			<source src="test.mp4" type="video/mp4" />
		</video>
	</body>
</html>




Picture showing the output of video tag in html5



Browser Support


BrowserMP4WebMOgg
Internet ExplorerYESNONO
ChromeYESYESYES
FirefoxYESYESYES
SafariYESNONO
OperaYES (from Opera 25)YESYES



Posted By  -  Karan Gupta
 
Posted On  -  Sunday, November 26, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250