HTML5 - Video Tag




HTML5 Video Tag

The HTML 5 <video> tag is used to specify video on an HTML document. For example, you could embed a music video on your web page for your visitors to listen to and watch.

Before, HTML5 video sources could only be played in browser using plug-ins such as Flash;

Nowadays the HTML5 <video> tag can be used to embed video HTML can display;

The text inside of <video> tag will be shown if the browser does not support the HTML5 video player Tag;

The <video> tag supports MP4, WebM and Ogg formats only;

HTML5 specifies the DOM methods, properties, and events for the <video> tag which can be used for controls, duration, volume, etc.

The HTML <video> Tag

Example

<!DOCTYPE html>
<html>
<body>
<video width="300" controls>
 <source src="https://cdn.rawgit.com/bitdegree/banners/c54b4c24/learn/Pexels%20Videos%203373.mp4?raw=true" type="video/mp4">
 <source src="https://cdn.rawgit.com/bitdegree/banners/57000627/learn/Pexels%20Videos%204754.ogg?raw=true" type="video/ogg">
 Your browser does not support the video tag.
</video>
<p><strong>Note</strong> − Your browser does not support the video tag.</p>
</body>
</html>

Result

Note − Your browser does not support the video tag.

HTML5 Video Tags

<video> − Defines a video or movie

<track> − Defines text tracks in media players

<source> − Defines multiple media resources for media elements, such as <video> and <audio>