Video Player In HTML5
There has been no standard to show videos on webpage.The provision of video has been facilitated by flash video(.flv) file format.HTML5 includes the support of video on web.
Advantage Of HTML5 Over HTML4.01
HTML5 includes a video tag.
HTML5 Video Formats Supported
Several browsers have started supporting the video element of HTML5.But only 3 video formats are supported by the major browsers.
Working Of Video Tag
Here is the code to play a video file.
The above will work only in chrome10.0,firefox 4.0,opera 10.5.But will not work in Internet Explorer because it does not support WebM format.
IE9 only supports Mpeg4.So we change the code to make it work in all browsers.The modified code is:
The browser picks one of the three formats available and plays the audio file.Click on the play button and listen to the song.
HTML5 Video:The Control Attribute
The control attribute of HTML5 specifies the browser to display the standard playback controls.There are various attributes in HTML5.
widthSets the width of the video player
|controls||Specifies the controls such as volume|
|autoplay||Plays the video automatically|
|audio||Defining the default state,only muted is allowed|
|height||Sets the height of the video player|
|src||Specifies the url of the audio|
|preload||Specifies url of the image representing the video|
Related HTML5 topics:
- HTML5 New features
- HTML5 Web Storage
- HTML5 Introduction