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.


HTML5 specification on media elements can be found at

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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.