I noticed that when a html5 video is loading (buffering), it's buffered.length
value is 2, and when it finish loading, it changes to 1.
Would this be a reliable way to know if a video is already stored in the cache (buffered.length == 1
)? If not, am I missing something? Could someone explain me exactly what does this value tell me?
According to the Apple HTMLMediaElement
documentation, buffered
is TimeRanges
which is why the length property seems to be wrong
the buffered percentage can be calulated by using
video.buffered.end(0) / video.duration