Articles → HTML 5 → Video Tag In Html5
Video Tag In Html5
Purpose
Syntax
<video controls or autoplay>
<source src=" " type=" " />
<source src=" " type=" " />
</video>
- You can either mention controls or Autoplay attributes in the video tag
- Controls attribute adds controls like play, pause, and volume
- The Autoplay attribute plays the video automatically when the page gets loaded
- 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>
Browser Support
Browser | MP4 | WebM | Ogg |
---|
Internet Explorer | YES | NO | NO |
Chrome | YES | YES | YES |
Firefox | YES | YES | YES |
Safari | YES | NO | NO |
Opera | YES (from Opera 25) | YES | YES |