How you can help: HTML5 native audio support

How you can help: HTML5 native audio support

bart's picture

Greets!

I'm posting this here in response to a post on another thread.  It was suggested that OGA move away from Flash for audio previews and start serving up HTML5 native audio instead.  I want to state for the record that I think this is a nice idea in theory, but in practice there are some things that prevent me from doing it:

  • Flash generally works across most systems.  In some cases it doesn't work well, but it's a single solution, if a crappy one.
  • HTML5 audio isn't supported across all browsers.
  • Some browsers that support HTML5 audio support OGG only, because licensing fees prevent them from supporting mp3.
  • Some browsers that support HTML5 audio support MP3 only, because the companies that make those browsers thrive on a lack of interoperability in order to sell their products.
  • I can't support one or the other without alienating a significant (20%+) portion of our users, which would mean...
  • I would have to support both, and also a Flash fallback for browsers that can't handle it at all, and...
  • I don't have time to do that.

Audio, unfortunately, is hard.  It took me quite a while to get the audio previews converting from the massive list of audio formats and archive formats into usable preview files.  It worked, it stopped working, I made it work again, and now it seems to be running reasonably well.  This is good.

At bare minimum, for every audio file that's uploaded, I would need both an mp3 and an ogg version of that file.  This will consume extra storage space, which isn't that big of a deal right now, but it might become one.  The larger problem is implementation.  Audio formats are a precarious thing.  Audio conversion programs that run on CentOS and can actually handle day-to-day conversion tasks (ie, convert files to and from mp3 format) are not very well supported because, due to perfectly understandable licensing concerns, the CentOS project is unable to do so.  So sometimes, when I update my packages, something will be replaced that breaks my custom-compiled audio conversion program and knocks audio preview generation offline.  Converting to a second format will make this worse, and will require more maintenance.

Then, there's the matter of a javascript audio player.  I'm told they exist, and I've even seen a few, but I'll need something with a very small form factor (good for previews, like the current flash audio player we have now) that works reliably across all of the browsers which support HTML5 in their various disparate ways.  Preferably this should not be written from scratch, but be a maintained project that already exists in the wild.

Finally, there are the browsers that don't support HTML5 audio at all.  What I'll need to do in their case is check their browser identification (something that's harder than it sounds given how many possibilities there are) and then show the old flash player for those unsupported browsers.  Furthermore, I'll have to make sure that the flash audio player and the javascript audio player are always consistently the exact same size, which is ugly when you're trying to do it across six different browsers, some of which have very loose definitions of "standards complient."

END RANT

Sorry about the above.  As you can see, as a lone developer, there are a lot of issues I have to take into account.  I reluctantly settled on Flash for audio previews because it works for the largest number of people.  For the record, I feel cheap doing it.  I don't particularly like that I had to do it, but it's more important to me to include that larger user base than it is to use strictly Free software at all levels of my site, because I've always believed that the people who aren't users of FOSS are the ones who would benefit the most from being exposed to it, and in a friendly and welcoming kind of way.  To meet this goal and still have HTML5 audio, we would need:

  • An HTML5 audio player that works across browsers
  • Two different audio formats
  • The old Flash audio player
  • Javascript code to detect which browsers can't handle native audio

If you work with PHP (and particularly Drupal) and HTML5 audio support is important to you, I would love to have it, but I need your help.  We've got a lot of features that will be going into OGA 2.0, and this one will be a lot of trouble for something that already works for the most part.  On the other hand, in terms of staying mostly FOSS pure, it would be really nice if someone could step up and do it.

Any takers? :)

Bart