Playing Videos in HTML
There was no standard format to show videos on a web page before the launch of HTML5,.
Videos was only played using a plug-in (like flash).
The HTML5 <video> element is used to specify a standard way of embeding a video in a web page.
The HTML <video> Element
For showing a video in HTML, make use of the <video> element:
How it Works
The controls attribute is used to add video controls, like play, pause, and volume.
It is a good method to always use width and height attributes.
If height and width are not mentioned, the browser will not know the size of the video. The effect of this is that page will be changing (or flicker) while the video gets loaded.
Text between the <video> and </video> tags will only get displayed in browsers which do not support the <video> element.
Multiple <source> elements can be used to link different video files. The browser will be using the first recognized format.
HTML <video> Autoplay
For starting a video automatically make use of the autoplay attribute:
The autoplay attribute will not work in mobile devices like iPad and iPhone.
HTML Video - Browser Support
At present, 3 video formats are supported for the <video> element: MP4, WebM, and Ogg:
|Opera||YES (from Opera 25)||YES||YES|
HTML Video - Media Types
|File Format||Media Type|
HTML5 Video Tags