DOM Properties
HTMLMediaElement.buffered
TimeRanges snapshot of buffered intervals in seconds. There may be gaps; check length before accessing boundaries. Read the property again as downloading progresses; the returned object describes the intervals at that moment. Do not calculate a buffered percentage from the last endpoint alone when the ranges are disjoint or duration is unknown. Example result: 0.
Formal Syntax & Structure
html syntaxhtml
media.bufferedReturn Value
TimeRanges
A static normalized TimeRanges object containing buffered intervals.
Working Example
Example Snippethtml
<p> Result: <output id="result"></output></p><script> const result = document.getElementById("result"); (async () => { const media = document.createElement("audio"); document.body.append(media); result.textContent = media.buffered.length; })().catch(error => { result.textContent = "Error: " + error.name; });</script>