English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag List

HTML Audio/Video DOM buffered property

HTMLMediaElement.buffered returns a read-only TimeRanges object that returns the buffered area of the media

 HTML Audio/Video DOM Reference Manual

Online Example

Get the first buffered range of the video in seconds (partial):

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Video buffered property usage-Basic Tutorial(oldtoolbag.com>/title>
</head>
<body>
<button onclick="getFirstBuffRange()" type="button">Get the first buffered range of the video</button>
<br> 
<video id="video1" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg>
  Your browser does not support HTML5 video  tag.
</video>
<script>
myVid=document.getElementById("video1");
function getFirstBuffRange()
{ 
  alert("Start: " + myVid.buffered.start(0) + " End: "  + myVid.buffered.end(0));
} 
</script> 
</body>
</html>
Test to see </›

Definition and Usage

The buffered property returns a TimeRanges object.
The TimeRanges object represents the user's audio/Video buffered range.
The buffered range is the buffered audio/The time range of the video. If the user skips the audio/If the video is buffered, multiple buffered ranges will be obtained.
Note: This property is read-only.

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the buffered property.

Note:Internet Explorer 8 And earlier versions do not support this property.

Syntax

audio|video.buffered

Return value

TypeDescription
TimeRanges objectRepresents audio/The buffered part of the video.

Properties of TimeRanges objects:

  • length - Get audio/The number of buffered ranges in the video

  • start(index) - Get the start position of a buffered range

  • end(index) - Get the end position of a buffered range

Note:The first buffered rangeSubscriptIs 0.

 HTML Audio/Video DOM Reference Manual