sound-alert.js
v0.0.4
Published
Play Sound Alerts
Downloads
3
Maintainers
Readme
sound-alert.js
JavaScript library to play sound alerts
alert = require('sound-alert.js')
alert() // Plays default alert "bottle"
alert('purr')
alert.volume(0.5)
See content.js
for all available sounds.
Try it at
Install
$ npm install alert
Manual
Available Sounds
- bottle (default)
- glass
- funk
- morse
- purr
- tink
- submarine
Adding Custom Sounds
alert.content['foo'] = ['http://bar.com/foo.mp3', 'http://bar.com/foo.ogg']
alert('foo')
How to use without NPM?
If your application isn't structured as a CommonJS package, you can download the distribution file;
$ wget https://raw.github.com/azer/alert/master/dist/alert.js
And include it on your page:
<script src="alert.js"></script>
<script>
playAlert('purr')
</script>
Accessing Audio API
alert.player.src()
// => foobar.mp3
alert.player.on('ended', function(){})
More info is at azer/play-audio