best way to stop playing audio
Closed this issue · 1 comments
kindohm commented
What is the best way to stop (either temporarily or permanently) playing audio? So far in my code I've used something like this:
var callback = audioCallback(buffer, channels) {
if (playing) {
osc.append(buffer, channels);
}
};
$(button).click(function () { playing = !playing; }
Is there a better or more formal way to stop the audio? With this method, audioCallback will always be called - the implementation is just bypassed.
jussi-kalliokoski commented
You can destroy a Sink
instance with the sinkInstance.kill()
method. This will stop all the callbacks, etc. However, that means you have to create a new Sink if you want to continue playback.