HTML and CSS Reference
Embedding Video in (X)HTML5
In contrast to the complexity of video embedding with the object element in XHTML, (X)HTML5 provides the video
element, which is easy to use, has full control over the video being embedded, and adds semantic meaning to the
markup. The video element is supported in IE9+, Firefox 3.5+, Chrome 3.0+, Opera 10.5+, and Safari 3.0+. However,
its usability depends also on the supported codecs. If you just think of DivX, Xvid, WMV, FFmpeg, 3ivx, Sorenson, or
Flash Video from the enormous variety of video file formats, the video codec support of web browsers is undoubtedly
in its infancy (Table 9-4 ).
Table 9-4. Overview of Video Format Support for the video Element in Different Browsers
While there is no need to maximize the number of natively supported video formats on the Web, the reliable
support for the most widely used, advanced formats would be desirable.
■ many video files are stored in container formats that are not restricted to one kind of video and audio codec.
Consequently, the full support for a video container should include the support for all kinds of video and audio codecs
allowed in that container format. For example, if browser vendors would like to introduce support for .flv Flash videos,
it would require support for the h.264/mpeG-4 aVC, Sorenson, Screen Video, and Vp6 video codecs, as well as the aaC,
adpCm, Linear pCm, nellymoser, mp3, and Speex audio codecs. moreover, many codecs have proprietary licenses or are
encumbered by patents (this is the reason why Chrome dropped the h.264 support). the different associations of audio
and video codecs along with the licensing issues make it rather complex to standardize video implementations on the
Web. different formats are suitable for different purposes and application areas, and there is no ultimate choice for video
publishing as it depends on the scenario.
Listing 9-25 shows the basic code for the video element.
Listing 9-25. Basic Video Embedding in (X)HTML5
Features such as height or width can be added optionally. An image representing a frame from the video
(alternate content) can be defined as the value of the poster attribute (displayed when the video cannot be rendered).
Alternate markup can be defined as the element content between the opening and closing video tags (Listing 9-26).
14 To avoid patent issues, Firefox has no native H.264 support, and relies on a decoder from the OS.