Prevent HTML5 buffering of entire mp3 on pause

I see that the HTML5 audio element is buffering some of the MP3s when I click the play button, however when I call pause()

it then downloads the entire file. How can I prevent this?

+3


source to share


2 answers


It depends on the browser implementation. Buffering is not specified in the specification . Your only option is to remove and restore the audio element.



0


source


Buffering is done for every browser, there is a way to hack this by removing the src element (changing it to an empty string) on ​​pause and resuming it as soon as the play button is pressed again. This will most likely be the closest you get, and it can cause problems in a variety of browsers as this is a hack.



0


source







All Articles