How to determine when buffering is finished on a HTML5 Audio element
I'm trying to determine when the buffering has finished from a HTML5 audio element, but so far I can't find any loadComplete
or similar event. I've tried using the progress event however it doesn't fire when finished downloading - only while downloading and therefore I can't use that to check. I've also tried the standard load
event but that seems not to fire at all.
What other开发者_如何学Python events are there that would allow me to check if buffering is finished, or would I have to use a timer to keep checking if a.buffered.end(0) == a.duration
?
Thanks,
The Audio Data API provides an event called MozAudioAvailable which does what you need. This is in Firefox 4 only, but other modern browsers may implement it in the future.
精彩评论