Note: this post is archived from the now closed ofmlabs.org.
Once upon a time in Dublin
I’m taking the time to write these few lines on the plane back from Dublin, absolutely pumped by the week-end we just lived together.
ofmlabs has been having regular meetings with its core members and invited individuals since day one. Since we live in Switzerland, Sweden, Germany, Finland, and the USA, we like to take the time to see each other in person and have productive 48h hackathons.
This week-end was different: for the first time, a start-up generously offered office space to the six europeans of us and our guests. Eamon Leonard, co-founder of orchestra.io, expressed his belief in our work and the open web, and was happy to contribute by hosting us!
orchestra.io is a scalable PHP hosting platform, recently acquired by Engine Yard. It might seem like we are into very different businesses here, yet we all have a common goal here: to help the web mature into a strong and usable platform.
While great strides of progress have been made, we believe that in the area of audio and video, there is definitely a lot of room for improvement. As I tried to explain in my jsconf.eu talk, the HTML5 audio tag still has a long way to go to even reach feature parity with proprietary technology such as Adobe Flash.
Mark Boas, of Happyworm, whom we were happy to welcome in our coding party, can tell you about the amount of work he and his associate have put into jPlayer merely to work around implementation bugs in the audio and video tags in modern browsers.
Even when just considering the leading edge duo of browsers, Chrome and Firefox, building consistent solutions on the web involving multimedia without Flash is still a challenge today. As for other browsers, the web community at large is looking forward to the IE team continuing its efforts reaching out to developers to better understand their needs. The Opera team can be praised for committing very closely to the specifications, even when other browsers clearly went their own way.
Flash vs the world
Just today I learned about the Occupy Flash movement. While my heart yearns for the quick death of Flash, it still holds the edge in multimedia on the web, and for good reasons. All the major streaming platforms still use Flash to stream their content. At the time of this writing, Flash is the only answer for problems like stream encryption, live broadcasting, etc. YouTube has just recently started to take advantage of new Adobe Flash features such as seamless transition between quality settings.
Building the web is a long and tedious task. Organizations like the W3C and the WHAT-WG assemble dozens of big companies, all with their own corporate interests and often vigorous point of views on the questions being discussed. Good intentions from individual developers are not enough. A recent W3C discussion thread tried to raise awareness about the disconnect between standards organizations and web developers all around.
Trying to free the web of proprietary plugins is a noble goal to which we are committed. But it would be dishonest to strip people of the interactivity they have gotten used to, if we have no acceptable solution to offer them in exchange.
Technology such as Flash can evolve very quickly. With the recent announcement of Flash being discontinued on mobile devices (as a plugin, but still present in Air applications), I don’t think anybody saw the seamless quality transition feature coming. I certainly didn’t. Yet, it is so very easy to come up with a new cool feature when you are on your own, not having to reach consensus with a big group of companies having sometimes misaligned interests.
How long until such a feature hits HTML5 audio and video? From where we are standing, it feels like forever. The W3C Audio Working group is experiencing difficulties. Scarce meetings (if any), decisions being made internally by companies disregarding the opinions of the working group, unwillingness to let individual developers express themselves…
In the end, if no big company is interested in the same feature as you, individual developer, what can you do? For the time being, not much.
What standards are made of
This is where the cracks begin to show in the way web standards and browsers are being developed. It is being presented as a democratic process where anyone can get involved, but the reality is big browser vendors negotiating interfaces so that the web doesn’t explode from the fragmentation.
Unfortunately, it is not only about politics. From a software engineering perspective, the current modularity of multimedia support in browsers leaves a lot to be desired. As often, it seems that only the minimal use case has been implemented: throwing a raw piece of audio/video in your page. The default player controls are often everything but polished.
However, there is so much more to do with multimedia content than just a rectangle with a play button! This is is something people such as the popcorn.js team and web demoscene figure mrdoob keep showing in their work. The goal of all these additions to web browsers - seen not long ago as way to navigate text on steroids - is to be able to create rich, interactive multimedia compositions that will be able to reach an incredibly wide audience, now that the hardware and network infrastructures are available.
When trying to make an apple pie, you don’t go and buy a crumble, take the cooked apples out and use them in your new meal. You go and buy fresh apples at a grocery store, then cut them, arrange them to the pattern that you want, and cook them. Sure, they both have apples in them, but they are two very different food items, and it would be foolish to try and turn one into the other.
That is exactly the problem with HTML5 audio and video elements. They are very tasty pieces of software, but they are not well adapted for every use case out there. Since they depend on the DOM, doing real-time audio processing with them is impossible due to delays, memory usage, etc. On certain platforms (I’m thinking mobile here), it’s simply impossible to play several audio elements at once. It might be Apple trying to save native apps or just trying to preserve the overall performance of its devices, but it’s a major show-stopper for HTML5 games.
Low-level multimedia APIs: the land of the free
Once you get low-level access, i.e. you can directly write audio samples into the audio devices available, suddenly a world of possibilities open up. You can do multi-channel mixing yourself, for games or music sequencers. You can generate sound programmatically, like in audiolib.js. You can start playing sound samples exactly when you want, you can make a gapless music player if you want. You can mix generated sound with existing recording of instruments and noises. You can do anything with fresh apples.
And guess what, we can already do that. Along with the HTML5 audio and video tag I have mentioned above, Chrome integrates the Web Audio API, and Firefox integrates the Audio Data API. Using those APIs, you can write any audio data you want to your soundcard, just like we talked above. What are we complaining about, then? For one, there are two different APIs.
Where do we go from here?
You can also read Mark Boas’s article about low-level audio APIs, published earlier this year, which covers the same substance with a different prose.