Tuesday, 26 January 2010

Audio, Video, HTML5 and standards

The chaps at Mozilla, Christopher Blizzard and Robert O'Callahan reopened the HTML5 <audio> and <video> debate yesterday, with a spirited defence of their decision to support only the patent-unencumbered* Ogg format and Vorbis and Theora codecs in Firefox releases as part of their HTML5 support.

Now, I understand their motives here - back when I was at Apple, I spent a big chunk of time trying get permission to add support for Vorbis to QuickTime, but didn't manage to get it past Apple management's fears. However, all the browsers I use now claim to support HTML5 <audio> and <video>, so I thought I'd try it out. I made some simple test pages using mp3, .au and WAV files, to see how they were supported.

What I found was a bit disappointing - it seems that the way that the spec is written, you can support <audio> but no file formats or codecs at all (my Droid does this), and if you can't play the file you're not supposed to show the fallback HTML contents

This means that Firefox, Droid won't show the link to the audio file below:

though browsers that don't support <audio> at all will. Here's the markup:
<audio src="http://homepage.mac.com/kevinmarks/dystopia.mp3" controls><a href="http://homepage.mac.com/kevinmarks/dystopia.mp3" type="audio/mpeg"> Looking Up From Dystopia </a></audio>

However, if I use a direct link or an embedded <iframe>, Firefox will use available plugins to play the file (both Flash and QuickTime happily play mp3's). Thus using <audio> give me less compatibility with current browsers.

On phone browsers, odder things happen - iPhone gives a clickable button for the <audio>, but auto-loads an <iframe>; Droid ignroes iFrames, Palm Pre doesn't have <audio> but <iframe> behaves like the iPhone.

Smarter behaviour with declarative audio would be nice here.

*Submarine patent trolls keeping periscopes down may exist.

2 comments: