Skip to content

hassle-free, cross-plattform, two-command wrapper to preload and play sound files

License

Notifications You must be signed in to change notification settings

reneroth/simpleSound

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

hassle-free, cross-plattform, two-command wrapper to preload and play sound files

Resources

License

Stars

Watchers

Forks

Packages

No packages published