Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 2.04 KB

README.md

File metadata and controls

43 lines (25 loc) · 2.04 KB

simpleSound

Latest Version Bower Software License

Hassle-free cross-plattform JavaScript audio preloading and playback.

Summary

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.

Install

Via Bower

$ bower install simplesound-js --save

Usage

You will need to have both .ogg and .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!

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.