Tuesday, December 11th, 2007
GWT Voices: Cross browser sound API
We featured SoundManager 2 awhile back, and we just ran across GWT Voices, an open source GWT module that abstracts away sound management so you can just do this:
- package com.mycompany.client;
- import com.google.gwt.core.client.EntryPoint;
- import com.allen_sauer.gwt.voices.client.Sound;
- import com.allen_sauer.gwt.voices.client.SoundController;
- public class SimpleApplication implements EntryPoint {
- public void onModuleLoad() {
- SoundController soundController = new SoundController();
- Sound sound = soundController.createSound(Sound.MIME_TYPE_AUDIO_MPEG,
- "url/to/your/sound/file.mp3");
- sound.play();
- }
- }
… and your file will be played across browsers. Voices supports native formats, and drops to Flash for others.





3.6 rating from 29 votes





I’ve been writing a series of Javascript audio tutorials and comments on my blog lately. There a are a few ways to go about it, but my latest foray has been pure Quicktime because it allows you to get a bunch of sweet callbacks to indicate loading and playback position, read ID3 tags, and even adjust the playback pitch. I’ve also released an open-source bookmarklet that installs a music player on any page that links to mp3s.
Yes the callbacks are nice but it can also be done in Flash/ActionScript. Also, not everyone has quicktime installed :P
I think the percertage of quicktime v. flash users you’d see typically:
%quicktime
Olmo, you’re right about flash uptake. Sadly flash is too paranoid to allow loading callbacks in the bookmarklet/userscript context. Most music listeners will have QuickTime because it’s included with iTunes. Hopefully HTML 5 will make all this a moot point.