简体   繁体   中英

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM