play-sound
play-sound copied to clipboard
pause/resume functions
Is there any way to pause/resume audio? Thanks
I also have the same issue .I want to make sure that audio gets completed before I resume my further work
Any news on this? Would be a neat feature :)
Yeah that is definetely needed
For anyone who might encounter this problem in the future, the workaround I found was by passing the 'SIGSTOP' and 'SIGCONT' flags when killing the audio process to pause and resume as mentioned in this SO post:
My code ended up looking something like this:
// access the node child_process as mentioned in the README
var audio = player.play('foo.mp3', function(err){
if (err && !err.killed) throw err
})
//To pause
audio.kill('SIGSTOP');
//To resume
audio.kill('SIGCONT');
I have only tested this on a Mac with afplayer as the default player, and I plan on testing it on the Linux board I'll be moving this over, so I can't speak to how well this works with other player or on Windows or Linux (yet).