HTML and CSS Reference
In-Depth Information
FIGURE 2-11 The video element in action.
Supported codecs
When it comes to codecs, video suffers from the same issues that audio does. Therefore, it requires
the same workaround.
You should not use the src attribute unless you are well aware of the concrete risk that the video
may not be playable on some browsers. To gain the widest support from HTML5-compliant browsers,
you should use the <source> element. Here's the rewritten content of the sample video.html file:
<video controls width="320" height="240">
<source src="/sample.ogg" type="video/ogg" />
<source src="/sample.mp4" type="video/mp4" />
<p>Your browser does not support the video element.</p>
</video>
Just as for audio, the <source> elements link to different video clips and the browser will use the
first format it knows how to support. As a guideline, you should plan to have an MP4-encoded video
for Internet Explorer and Safari, and OGG for all other browsers.
Search WWH ::




Custom Search