Saturday, 25 June 2011

Auckland Web Meetup Recap

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 :-).



Tuesday, 21 June 2011

Auckland Web Meetup

This Thursday night (June 23) we'll be giving a talk at the Auckland Web Meetup.

Web standards and browser implementations are rapidly evolving features that enable sophisticated games to be written as standards-based Web apps. These features include fast JS engines, GPU-accelerated 2D and 3D graphics (canvas and WebGL), video/audio, WebSockets, and emerging proposed standards for advanced audio effects, fullscreen APIs, and peer-to-peer real-time communication. We'll show some demos and benchmarks, explain about the technology behind them, describe the browser support landscape, and discuss what happens next. We want feedback from developers to help guide our priorities and technical decisions.

Indeed, as usual I'll be going to as much to get feedback from Web developers as to spread our own message.



Monday, 20 June 2011

CS Unplugged

I've been concerned about the teaching of computing in schools. At my children's primary school, they get a little bit of instruction in using a computer. There are even optional tests, with questions like "what does this icon do?". Unfortunately this seems to convey that a career in computing is all about using Microsoft Word, so anyone with a brain would dismiss such a career from an early age. Anecdotal evidence suggests that this does happen.

Early this year I saw Tim Bell from the University of Canterbury demo a few of the lessons from his site CS Unplugged, techniques for teaching computer science concepts to kids --- without using computers, which he views as often being just a distraction from learning these concepts, and I agree. I was keen to try this myself at my children's school, and last Friday I finally did, in my older child's class, with the help of my wife and another computer science-y couple who also have a child in that class.

We spent an hour and a quarter covering binary numbers, parity-based error correction, and a short discussion of searches using sorting and indexing. (For the latter I had the kids look words up in books with indexes, and discussed how Web searches work similarly. I had also manufactured an unsorted phone book and we compared lookup difficulty with a regular phone book, to try to convey the idea that you can make operations faster by organizing your data the right way.)

It went well. In this class of 9/10-year-olds, all the students could do the activities, Many found them easy but some needed help. This suggests to me that the activities were about the right level. Everyone seemed to enjoy it. I'd definitely do it again!



Thursday, 16 June 2011

Media Processing

A number of proposed features with overlapping spec and implementation requirements are popping up:


  • Advanced audio APIs that allow complex mixing and effects processing (e.g. Mozilla's AudioData, Chrome's AudioNode)
  • Synchronization of multiple HTML media elements (e.g. proposed HTML MediaController)
  • Capture and recording of local audio and video input (e.g. proposed HTML Streams)
  • Peer-to-peer streaming of audio and video streams (e.g. proposed WebRTC and HTML Streams)

At the API level, I want to integrate effects processing with capturing, recording and streaming by building an effects API for HTML Streams. There is a proposal on the Mozilla wiki --- it needs work.

At the implementation level, all these features should be built on a common foundation to ensure that current and future integration requirements can be met; trying to bridge separate implementation models while maintaining global synchronization, high throughput and low latency seems very difficult. My current project is to build that foundation. It's challenging but fun. I've made it my top priority partly because it could block work on the above features, and also because there is an urgent need for practical comparisons of a Stream-based processing API against less-integrated APIs.

I've found that to focus I really need to disconnect from the Internet. So I'm getting into the habit of working online in the first half of the day and then going offline around 2pm or 3pm (NZST) for the rest of the day. It's working. My apologies to anyone trying to find me online during that time.

My current plan is to build the foundation and just enough of the DOM API to support Worker-based audio synthesis and capture of stream graph output; then I'll be able to write tests for the framework. Then we'll hook up actual audio and video output, make the HTML media element implementation use the framework, and flesh out the new features.



Wednesday, 15 June 2011

Some Advice

Never, ever trust anyone who writes "PhD" after their name. Seriously.

To clarify: I have nothing against PhDs. I know lots of great people with PhDs. None of them write "PhD" after their name. People who write "PhD" after their name are trying to impress you.

Wednesday, 8 June 2011

Running

I never used to be able to run. When I was at school I'd be breathless and exhausted after one or two laps of the playing field, and I basically never ran if I could avoid it. On the other hand, I enjoyed walking arbitrary distances at speed.

Then a few years ago, on a whim I started running on the beach near my parents' house, and surprised myself by enjoying it. Since then I've often run short distances (a few kilometres). I was curious about what longer distances would be like, but I haven't had the time to try until a couple of times recently: a few months ago I ran 7km in 45 minutes (twice as long as I'd ever run before) and last weekend I ran 17km in two hours. It didn't seem difficult except that my feet got sore, which is perhaps because I was running barefoot: the problem is that if I run in any kind of footwear I own I quickly start feeling tired. There's probably something I could wear that would be OK, but this is part of my larger problem of not knowing anything about running so I'm probably doing it all wrong :-).