--- title: HTMLMediaElement.seekable slug: Web/API/HTMLMediaElement/seekable translation_of: Web/API/HTMLMediaElement/seekable --- <div>{{APIRef("HTML DOM")}}</div> <p>{{domxref("HTMLMediaElement")}}的只读属性<strong><code>seekable</code></strong>返回一个包含了用户可以跳转到的时刻的区域(如果有)的{{domxref('TimeRanges')}}对象。</p> <h2 id="Syntax" name="Syntax">Syntax</h2> <pre class="syntaxbox">var seekable = audioOrVideo.seekable;</pre> <h3 id="值">值</h3> <p>一个{{domxref('TimeRanges')}}对象。</p> <h2 id="示例">示例</h2> <pre class="brush: html">var video = document.querySelector("video"); var timeRangesObject = video.seekable; var timeRanges = []; //遍历所有时间区域并输出数组 for (let count = 0; count < timeRangesObject.length; count ++) { timeRanges.push([timeRangesObject.start(count), timeRangesObject.end(count)]); } </pre> <h2 id="Specifications">Specifications</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> <tr> <td>{{SpecName('HTML WHATWG', "the-video-element.html#dom-media-seekable", "HTMLMediaElement")}}</td> <td>{{Spec2('HTML WHATWG')}}</td> <td>No change from {{SpecName('HTML5 W3C')}}</td> </tr> <tr> <td>{{SpecName('HTML5 W3C', "embedded-content-0.html#dom-media-seekable", "HTMLMediaElement")}}</td> <td>{{Spec2('HTML5 W3C')}}</td> <td>Initial definition.</td> </tr> <tr> <td>{{SpecName('Media Source Extensions','#htmlmediaelement-extensions','HTMLMediaElement extensions, like for seekable')}}</td> <td>{{Spec2('Media Source Extensions')}}</td> <td>Specifies a new algorithm for returning the seekable time range of a media element whose source is a {{domxref("MediaSource")}} object.</td> </tr> </tbody> </table> <h2 id="Browser_compatibility">Browser compatibility</h2> <div> <p>{{Compat("api.HTMLMediaElement.seekable")}}</p> </div> <h2 id="See_Also" name="See_Also">See also</h2> <ul> <li>The interface defining it, {{domxref("HTMLMediaElement")}}.</li> <li><a href="/en-US/docs/Web/API/Media_Source_Extensions_API">Media Source Extensions API</a></li> </ul>