I was making custom controls for the HTML 5 Audio. I need to show the buffered duration. The duration property gives the complete duration from the metadata, and the buffered property is the currently buffered duration. I need to update the buffered duration as it changes. Is there an event that triggers when buffered duration of media file changes?
1 Answer
It seems you are looking for the progress
event.
Here is a description of all the events fired by media elements: http://www.w3.org/TR/html5/media-elements.html#mediaevents
-
Thanks @matthias.p ! That worked. I could not make that out from the description of the event.– PranjalCommented Aug 15, 2012 at 12:34
-
It looks like at least in Firefox 93 and Chromium 94 this event sometimes fires before
buffered
has actually been updated. I'm seeing bothseeked
andprogress
fire andbuffered
after a seek, andbuffered
still being the same as what it was beforehand. The only reasonable thing I've found is to also update my UI ontimeupdate
.– trembyCommented Oct 22, 2021 at 22:37