8

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.

4

2 回答 2

11

您不能多次调用start()AudioBufferSourceNode它们仅供一次性使用。

真正做到这一点的唯一方法是每次需要开始播放时AudioBufferSourceNode从底层创建一个新的。AudioBuffer

于 2013-09-06T18:32:29.387 回答
0

您也可以让它运行并简单地将其从增益节点断开,并且振荡器可能只是空闲/无声地产生波形。

于 2014-07-31T09:49:42.017 回答