HTML and CSS Reference
In-Depth Information
for (var i = 0; i < formats.length; i++) {
var result = videoElement.canPlayType(formats[i]);
// if empty string, convert to dashed string
if (result.length <= 0) result = "----";
// add row
results+="<tr><td>" + formats[i] + "</td><td>" +
result + "</td></tr>";
// append to page
<h1>What can your browser play?</h1>
<div id="results"></div>
The results of opening the page in various browsers are what we would expect from the dis-
cussions of codec support in Chapter 1 :
▪ Opera and Firefox answer probably for the WebM and Ogg Theora video types, and re-
turn an empty string for every other media type
▪ Internet Explorer answers probably for the four H.264 profiles, and an empty string for
all other types
▪ Safari answers probably for the four H.264 and the two MPEG-4 Visual Simple and Ad-
vanced types
▪ Chrome is the only user agent that just doesn't want to say no—answering probably for
the Ogg Theora and WebM types, and also the four H.264 types, and maybe for everything
The other HTMLMediaElement methods can be used to create a custom control. We'll also
need at least one of the HTMLMediaElement properties, currentTime. It and the other
HTMLMediaElement properties are listed in Table 5 . As you can quickly see, the HTMLMe-
diaElement interface is a busy little creature.
Search WWH ::

Custom Search