Chapter 8Multimedia: Using Native HTML5 Video

Adding video to your HTML documents is just as straightforward as adding audio: use the <video> tag. As with audio, the video element requires a closing tag (</video>) and a src attribute.

Create a new HTML document, and add the code below, changing the value of src to point to the media file of your choice. Save it as video.html, and open the file in your browser.

<video src="/path/to/media.file"></video>

You should see the first frame of your video, and that's it, as shown in Figure 8.1. As with audio, the video element lacks control by default (unless JavaScript is disabled).

A video player in Chrome Canary when the controls attribute has not been set. Image from "Big Buck Bunny" by the Blender Foundation,

Figure 8.1. A video ...

Get Jump Start HTML5 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.