HTML5 audio and video tags and Mozilla Firefox

One of the best things about HTML5 is that audio and video can be directly embedded in web pages in the obvious way — i.e. like images — with no weird third-party plugins or JavaScript required. This is a good thing. Unfortunately, while we’ve come to expect IE to not support anything good, it’s pretty disappointing to see that Mozilla has opted to only support the useless Ogg/Theora open source codecs. This means that in addition to having to code workarounds for IE (check for support for the tags, OK no problem) we have to check for support for specific codecs — and these checks are pretty damn annoying.

Checking for <video> or <audio> tag support is pretty straightforward:

function supportsVideoTag(){
    return !!document.createElement('video').canPlayType;

(I’ll leave figuring out how to do the same thing for audio tags as an exercise to the reader.)

But to check for specific format/codec support you need to actually verify that the specific file you’re wanting to play back is supported, which not only makes the code more complicated, but requires you to figure out the MIME string representing your file type, e.g. ‘audio/mp3’ or — worse — ‘video/x-new-fictional-format;codecs=”kittens,bunnies”‘ as the whatwg’s example puts it.

Here’s the thing — it would be nice to know that there’s some format — mp3 for audio, say — that will work 99% of the time if audio tag support is there. As it is, Firefox won’t play MP3s at all, and Webkit considers mp3s to be “audio/mpeg” while Chrome considers them to be “audio/mp3”. Heckuva job.

All this kind of defeats the whole point of “you can just embed audio/video in your web page without needing JavaScript and it will all Just Work”, right? So what possible reason can the Mozilla folk have for exacerbating this stupidity?

The general argument made by advocates off Ogg/Theora is that it’s Open Source and not subject to patent issues the way MP3 or H264, say, are. But the only reason that Ogg/Theora hasn’t been sued yet is that no-one uses it or cares about it. The GIF lawsuit only occurred when there was a paycheck involved. No-one is going to wake up their legal dream team to sue someone over zero revenue. In any event, calling APIs provided by OS vendors doesn’t expose you to anything. All the graphic rendering in OS X is done via proprietary fonts, using OpenGL and Apple’s implementation of Display Postscript. If you want to stick a pixel on the screen you’re calling OS subroutines that invoke code that infringes on all kinds of possible IP law. It’s. Not. Your. Problem.

Another argument is that Mozilla is trying to Do Good by forcing people away from Evil Proprietary Formats like MP3, AAC, H264, and Flash. But in fact what they’re doing is forcing us to pick an Evil Proprietary Format and Evil Proprietary HTML that will work as well as possible in as many places as possible, and that sure as hell isn’t going to be Ogg/Theora.

If Mozilla would pull its head out of its ass and support H264 then we could use video tags to deal with every platform except (1) Richard Stallman’s crippled netbook and (2) IE. We can support IE by wrapping the H264 in simple HTML which passes it to WMP or hot-swapping an Open Source Flash player into the tags (Flash will still not be open source, but the player can be).

And, in my case, Mozilla is forcing me to stop using Firefox. (Guess what? Webkit’s debugging tools are now ahead of Firefox’s anyway.)

Anyway, I’m now happily using Webkit on my Macs and Chrome under Windows (Chrome is still a bit too crippled on the Mac for me to love it).

Mozilla Firefox UI Fail

OK, I dig that Firefox 3.6 had to imitate Chrome’s UI skin baloney. It’s not Open Source if it won’t let you screw up your UI, right? But — how do I turn the rotten things off? (Edit: it’s buried under Manage Add Ons.) Chrome lets me turn off the skins in the most obvious place, I can’t even figure out where most of Firefox’s preferences have gone — do I need to type in some mystic URL just to unfrack up the UI now?

Chrome is now my default browser for Windows.

Blender 2.5 alpha 0

Sintel early render from Project Durian
Sintel early render from Project Durian

Blender 2.5 Alpha 0 is out and ready for download. The servers seem to be pretty much hammered right now. While the “Alpha 0” part may not inspire a huge amount of confidence, Blender in general is a pretty solid piece of software, so it seems reasonable to expect it not to blow up in your face.

New Features

This is an example of the property browser which is now context-sensitive and sanely organized
This is an example of the property browser which is now context-sensitive and sanely organized
  • Much better UI organization (and appearance). Properties are logically and consistently presented. Lots of context-sensitive controls and functionality.
  • Easy to customize UI on-the-fly (e.g. add commonly used features as buttons to the main tool palette) — although I haven’t figured out the keyboard shortcut customization (or maybe it’s buggy)
  • The spacebar menu now lets you quickly search for commands.
    The spacebar menu now lets you quickly search for commands.

    Much easier to find commands (the “spacebar” menu now lets you search for commands — so you can get to any command by hitting space and then typing the first few letters of its name).

  • Tool buttons have tooltips showing you the tools keyboard shortcut and Python equivalent (unfortunately it looks like it’s the Python equivalent that’s used for mapping keyboard shortcuts, which makes sense from an engineering point of view, but isn’t very user-friendly).
  • Fullscreen mode on Mac
  • Multiple window (and hence monitor) support
  • According to the release notes, there’s also cloth and smoke simulation and improved particles (I’d never used Blender’s particles before and it’s a testament to how much things have improved that I was able to get particles up and running in a few moments without looking at any documentation or tutorials).

My experience of Blender 2.5 thus far (pre-alpha) is that it’s quite stable and a lot more usable. The new version includes a 64-bit OS X version (yay!).