play-sound
Play sounds by shelling out to one of the available audio players.
Installation
npm install play-sound
Examples
var player = require('play-sound')(opts = {})
player.play('foo.mp3', function(err){
if (err) throw err
})
player.play('foo.mp3', { timeout: 300 }, function(err){
if (err) throw err
})
player.play('foo.mp3', { afplay: ['-v', 1 ] }, function(err){
if (err) throw err
})
var audio = player.play('foo.mp3', function(err){
if (err && !err.killed) throw err
})
audio.kill()
Options
players
– List of available audio players to check. Default:
player
– Audio player to use (skips availability checks)
Prior art
- play.js - play sound files from node.js to your speakers
License
MIT