A Javascript library for working with Audio. It provides a consistent API for loading and playing audio on different browsers and devices. Currently supports WebAudio, HTML5 Audio, Cordova / PhoneGap, and a Flash fallback.
Safari lacks Ogg support, and Firefox and Chromium do not support Mp3. This is much more future proof than the current solution of swapping the file extension for different browsers.
For example, what if chrome dropped ogg in favor of some webm-like audio format. Code would have to be updated, existing assets would need to be converted.
If the source tag were to be used, then the developer could change
SoundJS.filetypes = ["ogg", "mp3", "m4a"] to SoundJS.filetypes = ["ogg", "mp3", "m4a", "weba"] without having to fiddle with documentation of the audio formats that a browser supports.
The browser would only load the format that it needs.
Safari lacks Ogg support, and Firefox and Chromium do not support Mp3. This is much more future proof than the current solution of swapping the file extension for different browsers.
For example, what if chrome dropped ogg in favor of some webm-like audio format. Code would have to be updated, existing assets would need to be converted.
If the source tag were to be used, then the developer could change
SoundJS.filetypes = ["ogg", "mp3", "m4a"] to SoundJS.filetypes = ["ogg", "mp3", "m4a", "weba"] without having to fiddle with documentation of the audio formats that a browser supports.
The browser would only load the format that it needs.