Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebAudio not playing after stop(0)

I'm writing something like a web-audio-editor, and I think I'm close to finishing the basics. I can play and stop an audiofile, but when I try to call the play method again it just won't work, even though the parameters havn't changed.

I'd be glad to see someone look into my problem as I cannot see why it doesn't work when similar code in other projects does. Unfortunately I cannot create a jsfiddle, because I would need to load an external mp3-file and it seems I'm not allowed to do that. But I have pasted the javascript here and the corresponding html file here.

All you need is a server you can upload the files to and a mp3 on it. Alternately you could use this link, but I will delete the files eventually.

like image 833
causa prima Avatar asked Sep 06 '13 15:09

causa prima


1 Answers

You can't call start() on an AudioBufferSourceNode more than once. They're one-time-use only.

Really the only way to do this is to create a new AudioBufferSourceNode from the underlying AudioBuffer every time you need to start playback.

like image 181
Kevin Ennis Avatar answered Sep 20 '22 14:09

Kevin Ennis