Saturday 25 June 2011
Yesterday night I went to the Auckland Web Meetup at the Telecom building. Nice building! Apparently there were 180 people there.
The first talk was about a task management Web app that some local people are building; that seems like a hard market to crack.
The second talk was about optimizing CSS, HTML and JS for page load times. It was interesting to see what Web developers are telling each other. Most of the suggestions were good, but there was some advice to put external script loads as late in the HTML page as possible. That probably made sense in older engines -- it let other resources start loading without having to wait for scripts to load. However, modern engines can speculatively parse past a <script src> element before it finishes loading, so these days it's probably best to put external script loads as early in the HTML page as possible.
Then there was a break and a bit of a scrum for pizza :-).
Then it was my turn. My plan was to show a few modern HTML games, explain the technologies behind them, discuss the current browser support landscape and related issues, and then talk about missing features and future APIs that may address those features. I didn't have time to prepare any slides; I only had notes listing topics I wanted to cover. I think it went pretty well anyway.
The demo sites were Pirates Love Daisies, the 2d-canvas version of Angry Birds (the "HD" WebGL version doesn't seem to work in Firefox trunk; I think it may have been broken by the same-origin texture loading restriction), and Quake 3 WebGL. I had no network and one thing that became immediately obvious was that these games don't work well offline :-).
Pirates and Angry Birds use 2D <canvas>, which benefits from acceleration in Firefox and IE9, and there's not much else to say about that for now.
Pirates and Quake 3 use HTML <audio>, and both provide Ogg files. Angry Birds uses MP3 played by Flash, for various reasons but probably partly because Chrome's <audio> support has some problems. I talked a bit about the codec issues, including out-loud wondering why everyone can't at least ship support for Ogg Vorbis, since it's a good format that is very widely used (including even by Microsoft, in some products), without encountering patent problems. JSMad is an interesting approach: decode audio in JS. (This was a good time to talk about how JS engines are so much faster at manipulating binary data now, especially Spidermonkey and JM/TM.) The equivalent of JSMad for Vorbis would be an interesting way to support Vorbis on uncooperative browsers. When MP3 decoding comes out of patent coverage (Real Soon Now), we should implement in Firefox in a hurry, and that will also help developers by providing a decent (albeit not as good as Vorbis) baseline audio codec.
I went on to talk about WebGL and the issues around it. Microsoft seems to be resisting it for now, ostensibly due to security issues but I take that with a grain of salt due to Silverlight supporting a very similar 3D API with the exact same issues. I think WebGL will win and Microsoft once again will have to follow the lead of the other Web browsers. Nigel Parker from Microsoft did point out that Apple are backing off making WebGL fully available on iOS, although why is anybody's guess.
An interesting feature that I didn't know about until recently is that Pirates supports touch events; apparently because IE9 supports touch events on Windows tablets, which I also didn't know until Nigel pointed it out last night. Nigel had been such a good sport while I carped about Microsoft that I had to give Microsoft enthusiastic credit for supporting touch events already.
I went on to talk about future APIs: audio effects APIs, basically repeating what I said on my blog recently; full-screen APIs; and communications APIs --- Websockets and upcoming RTC work.
During this talk I grumbled to the audience about the attention browser vendors get for pushing out half-baked new APIs compared to the attention they get for doing a really good implementation of an API. Web developers tend to be a lot more excited about the former than the latter, which encourages browser developers to do more of the former at the expense of the latter. For the sake of the Web we should all try to change that.
At the end of the talk I asked the audience to give feedback on features they need that we didn't talk about. The first request was "text-overflow:ellipsis", so I was able to answer "landed yesterday; next?" :-). (I'll write more about text-overflow later; it's a good example of the issue in the previous paragraph.) Another request was DRM for Web video. That's a really difficult topic and I didn't have much to say. Someone asked for Mobile Firefox on the iPhone, which is another difficult topic and outside the scope of my talk, but I did give me a chance to rant a little bit :-). OK, to be fair the whole talk was a bit ranty :-).
Anyway, it was a ton of fun and I hope the audience had as much fun as I did, and hopefully learned something too :-).