TimeRanges: length 屬性
TimeRanges.length 只讀屬性返回物件中範圍的數量。
值
一個數字。
示例
給出一個 ID 為 "myVideo" 的影片元素
js
const v = document.getElementById("myVideo");
const buf = v.buffered;
const numRanges = buf.length;
if (buf.length === 1) {
// Only one range
if (buf.start(0) === 0 && buf.end(0) === v.duration) {
// The one range starts at the beginning and ends at
// the end of the video, so the whole thing is loaded
}
}
此示例檢視時間範圍,並檢查是否已載入整個影片。
規範
| 規範 |
|---|
| HTML # dom-timeranges-length-dev |
瀏覽器相容性
載入中…