Playing video files

In order to add native support for videos in the browsers, HTML5 introduced the video element. This is very similar to an audio element, and the same attributes apply since they both share common interface. There are few other attributes that are available only for the video element. Also the codecs for the source are mostly different, for video we have H.264/MPEG-4, VP8, VP9, and Theora.

In this recipe we will see how to use the built-in player by creating a simple page.

Note

HTML5 specification on media elements can be found at http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html.

Getting ready

We need a video file to play with our player, so you can pick one on your own. We have picked to use one ...

Get HTML5 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.