HTML and CSS Reference
In-Depth Information
</video>
</body>
Both the video and audio elements can contain zero or more source elements. These child
elements define a way to specify more than one audio or video file in different formats. If
a browser doesn't support one format, hopefully it will find a format it supports in another
source element.
WARNING
If you use the src attribute on the audio or video element, any contained source elements are ig-
nored. Using both also generates a HTML5 validator conformance error. Use one or the other, but not
both.
What happens if the browser or user agent does not find a video or audio file it supports? Both
of the media elements do allow other HTML within their opening and closing tags, so can this
other HTML be used as fallbackcontent?
Unfortunately, the answer is “no”. You can include other content in the media elements, but
that content is only for browsers and other user agents that don't support either the audio
or video elements. For instance, if you open a web page containing the HTML shown in
Example 1-3 in an older browser, such as IE 8 (or IE 9 running in Compatibility View), the
YouTube video is shown rather than the embedded video.
Example1-3.HTML5webpagewithembeddedvideoelementwiththreeseparatevideo
types and fallback content for user agents that don't support HTML5 video
<!DOCTYPE html>
<head>
<title>Big Buck Bunny Movie</title>
<meta charset="utf-8" />
</head>
<body>
<video controls>
<source src="videofile.mp4" />
<source src="videofile.ogv" />
<source src="videofile.webm" />
<iframe width="640" height="390"
src="http://www.youtube.com/embed/YE7VzlLtp-4">
</iframe>
</video>
</body>
Search WWH ::




Custom Search