simpleSound is a small wrapper designed to handle the preloading and playback of sound files. It uses the Web Audio API for playback, but falls back on HTML5 audio tags when necessary. Same goes for audio file formats, it will fall back to ogg files if MP3 support is not available.
It also overcomes the arbitrary requirement of iOS WebKit, which only allows sound files to be triggered on an explicit user action. This makes independent playback possible, like it's used for HTML5 games.
It does not utilize jQuery or any other third party plugins, this is a simple standalone script.
$ bower install simplesound-js --save
You will need to have both
.mp3 versions of every sound file, in the same folder.
Then just call
simpleSound.load('filename_without_extension') to preload the sound and
simpleSound.play('filename_without_extension') to play the sound. It's that easy!
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.