You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the bug report! This seems to be another one of those ways in which Safari's support for webAudio is slightly different from Chrome (MDN says, for the stop method, "If the node has already stopped, this method has no effect" which makes it sound like no error should be thrown, but apparently it can be).
You're correct that the buffer source node does not provide a way to check if it is playing directly, so we need the flag. Your check for the flag seems to work- I'll make a PR. Thanks!
Expected behavior
Clicking the stop sign twice with a sound playing, should stop the sound with no errors.
Actual behavior
The first click stops the sound, the second click throws an exception and stuff stops working
Steps to reproduce
Add a click-flag-hat and a play-sound-until-done under it. Click the green flag, click the stop button twice.
Operating system and browser
macOS and Safari 11
Notes
This can be fixed by changing the check in https://github.com/LLK/scratch-audio/blob/develop/src/SoundPlayer.js#L51 to
if (this.bufferSource && this.isPlaying)
.If possible I guess it should check if the buffer source is playing, but I'm not sure that's possible.
The text was updated successfully, but these errors were encountered: