This page is work-in-progress. You can reach me on twitter or mail to rezoner1337@gmail.com

Paths

The default path is sounds/ but you can always change it:

this.audio = new SoundOnDemand();

this.audio.path = "assets/sounds/";

Prefered audio format

Prefered audio format is ogg then mp3

If system doesn't support prefered audio format it will switch to the other one.

You should simply provide both ogg and mp3 version of your sounds.

You can change prefered audio format:

this.audio.preferedAudioFormat = "mp3";

How the paths are resolved

Assuming ogg is format prefered by the browser and path is sounds/:

sound.play("explosion");        /* sounds/explosion.ogg */
sound.play("themes/mainmenu");  /* sounds/themes/mainmenu.ogg */

Ask question:

Fork me on GitHub