\n
\n\n\n\nvar _hmt = _hmt || [];\n(function() {\n var hm = document.createElement("script");\n hm.src = "https://hm.baidu.com/hm.js?a7494b4230f4da5d7e5a093a005f3cd3";\n var s = document.getElementsByTagName("script"); \n s.parentNode.insertBefore(hm, s);\n})();\n
\n\n
\n \n
\n HTML Audio/Video DOM seekable Property
\n\n Last Updated: 2023-02-10\n This page: View Source | View Contributors\n
\n \n \n
\n \n
\n \n
\n
\n \n \n
\n Definition and Usage
\nThe seekable property returns a TimeRanges object.
\nThe TimeRanges object represents the user's seekable time range.
\nA seekable time range is a time range in which the user can seek. This is often referred to as the buffered range.
\n\n
\n Example
\nGet the first seekable range (in seconds) of the video:
\n\n
\n \n var vid = document.getElementById("myVideo");\nalert("Start: " + vid.seekable.start(0) + " End: " + vid.seekable.end(0));\n Browser Support
\n




The numbers in the table indicate the first browser version that fully supports this property.
\n| Property | \nInternet Explorer | \nFirefox | \nOpera | \nChrome | \nSafari | \n
|---|---|---|---|---|---|
| seekable | \n9.0 | \n3.5 | \n10.5 | \n3.0 | \n3.1 | \n
Syntax
\n\n
\n audio|video.seekable\n Property Value
\n| Value | \nDescription | \n
|---|---|
| TimeRanges | \nRepresents the seekable time range of the audio/video. \n A TimeRanges object contains one or more time ranges, where each time range is defined by a start time and an end time (in seconds). \n For example, the time range [0,2] would represent the time from 0 seconds to 2 seconds. | \n
Technical Details
\n| Return Value: | \nA TimeRanges object representing the audio/video's current seekable time range. | \n
|---|
More Examples
\n\n
\n Example
\nGet the video's first seekable range (in seconds):
\n\n
\n \n var vid = document.getElementById("myVideo");\nalert("Start: " + vid.seekable.start(0) + " End: " + vid.seekable.end(0));\n \n
\n Example
\nLoop through all seekable ranges and output them:
\n\n
\n \n var vid = document.getElementById("myVideo");\nvar ranges = vid.seekable;\nvar txt = "";\nfor (var i = 0; i < ranges.length; i++) {\n txt += "Start: " + ranges.start(i) + " End: " + ranges.end(i);\n}\nalert(txt);\n \n
\n Example
\nAlert the video's current seekable range (in seconds):
\n\n
\n \n var vid = document.getElementById("myVideo");\nalert("Start: " + vid.seekable.start(0) + " End: " + vid.seekable.end(0));\n \n \n
\n \n \n
\n \n \n
\n \n \n
\n \n \n
\n
YouTip