Question

In an html5 element I can set the current time of the audio track by simply changing the value of audio.currentTime, but I don't understand how to achieve this using the web audio api and a buffered source. I tried to change context.currentTime but it didn't work because it's read only.

How can I set the current time on a buffered source?

Was it helpful?

Solution

You can't change the current time in a playing buffersource the way you can seek in an element. You need to shut down the current node (stop() and disconnect()) and create a new buffersource node that points to the same AudioBuffer, and start it with the appropriate offset.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top