JavaScript library to play sound alerts
playAlert = require('alert-sound-notify')
playAlert() // Plays default alert "bottle"
playAlert('purr')
playAlert.volume(0.5)
See content.js
for all available sounds.
Try it at
$ npm install alert-sound-notify
playAlert.content['foo'] = ['https://bar.com/foo.mp3', 'https://bar.com/foo.ogg']
playAlert('foo')
If your application isn't structured as a CommonJS package, you can download the distribution file;
$ wget https://raw.github.com/rajvantchahal/alert-sound-notify/master/dist/alert-sound-notify.js
And include it on your page:
<script src="https://github.com/rajvantchahal/alert-sound-notify/raw/master/alert-sound-notify.js"></script>
<script>
playAlert('purr')
</script>
playAlert.player.src()
// => foobar.mp3
playAlert.player.on('ended', function(){})