HTML5 Guidelines for Web Developers

(coco) #1

70 Chapter 4—Video and Audio


with the browser manufacturers, because they make it much harder to find the
error in case of a crash.
HTML5 wanted to remedy this situation. The necessary new HTML element was
easily found: video. But that was not enough to solve the problem.

4.1 A First Example


We will give you a short example to demonstrate how easy the new HTML5 video
element is to use:

<!DOCTYPE html>
<title>Simple Video</title>
<video controls autoplay>
<source src='videos/mvi_2170.webm' type='video/webm'>
<source src='videos/mvi_2170.ogv' type='video/ogg'>
Sorry, your browser is unable to play this video.
</video>

You can play a video in the browser with remarkably little effort. In Figure 4.1 you
can see the result in Mozilla Firefox. The HTML syntax is almost self-explanatory,
but we will investigate it in more detail in the next section.

Figure 4.1 A video in WebM format in Mozilla Firefox
Free download pdf