O'Reilly logo

HTML5 Data and Services Cookbook by Mite Mitreski, Gorgi Kosev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required