Created
April 26, 2017 01:11
-
-
Save jonbri/30a6ed86c52185d969b688dfa2e5881e to your computer and use it in GitHub Desktop.
NodeJS: play audio file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var player = require('play-sound')(opts = {}); | |
var sFile = 'hello.wav'; | |
// access the node child_process in case you need to kill it on demand | |
var audio = player.play(sFile, function(err) { | |
if (err && !err.killed) throw err | |
}); | |
setTimeout(function() { | |
audio.kill() | |
}, 3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.npmjs.com/package/play-sound