The <video> element is used to play a movie or video clip on the website. Before the Html5 <video> element, it was compulsory to use the object and embed element and that was lengthy scripts. Now with the help of Html5 <video> element, it become easy and simple to use video file in website with few steps.
The current Html5 does not specify which video formats browsers should support in the video tag. But most commonly used video formats are ogg, mp4 and webm. <source> tag use to specify media along with media type. An video element also allows multiple source elements and browser will use the first recognized format.Html5 video element support all the attributes of audio element including width and height. It is always good to include width and height attributes. If height and width are set, the space required for the video is reserved when the page is loaded.
<video width="300" height="200" controls autoplay> <source src="video.mp4" type="video/mp4"> <source src="video.ogg" type="video/ogg" /> <source src="video.webm" type="video/webm" /> Your browser does not support the <video> element. </video>