There may be better options now.
There may be better options now.
I actually wrote a short-ass tutorial on that a while back, too. Mostly it's just JSNI, though. http://flax.ie/how-to-use-html5-audio-tag-with-gwt/#more-152
My engine code for the audio component is more or less the same as that, actually. I gave a small, quick explanation on that the other day: http://flax.ie/flax-html5-game-engine-development-diary-part...
</spam>
I found it fairly easy to do. We load the html for each sound object into the page, and then statically play/pause/stop/load them via the tag name. There's a JSON file, which contains a bunch of AudioContainer objects. When they're constructed, they construct their own HTML (so, the audio tag), and loads it into the page. Then we have a static-ish Audio service to make play/pause etc pretty easy. The JSON itself is made in our (as yet hypothetical) map editor. Must get to work on that, actually. ;)
I'm not massively happy with our solution, though. It works, but it's more complex than I feel it should be, considering that the actual implementation of it in js is so easy.
edit: I should point out that the entire point of the engine is so that you don't need Flash, which is why we're using <audio> rather than one of the pre-existing frameworks, like gwt-voices, which we would so totally use, if it didn't use Flash underneath somewhere.
Are you using http://code.google.com/p/google-web-toolkit-incubator/wiki/G... ? I'm eager for that to become part of standard GWT.
1. We didn't need 80% of the functionality that's in GWTCanvas (and canvas in general), and the 20% that we did need was a little buggy. We thought it'd simply be quicker and more efficient to build our own rather than modify or fix GWTCanvas.
2. <canvas> is, to paraphrase Tim Schafer, slower than molasses going uphill in january, on crutches. Might as well be using Flash, really. It also doesn't work on some browsers (we're unofficially, quietly, don't-tell-anyone-I-said-this, going for mobile device support as well), and doesn't work the same way across all browsers either.
What we've done is use a graphics abstraction layer, so that when the time comes that we implement it with the DOM (which we're slowly working on, but canvas will do for the moment), we need to change virtually nothing in the rest of the code.
Afaik the other half of the Flax project is writing a blog post as we speak about how we implement Canvas. I'll be sure to submit it to HN. ;)