TextTrackCueList
TextTrackCueList 介面屬於 WebVTT API,是一個類陣列物件,表示一個動態更新的 TextTrackCue 物件列表。
透過 TextTrack.cues 獲取此型別的例項,以獲取 TextTrack 物件中的所有 cue。此介面沒有建構函式。
例項屬性
TextTrackCueList.length只讀-
一個
unsigned long,表示列表中的 cue 數量。
例項方法
TextTrackCueList.getCueById()-
返回具有傳入識別符號的第一個
TextTrackCue物件。
示例
HTMLMediaElement.textTracks 屬性返回一個 TextTrackList 物件,其中列出了所有 TextTrack 物件,每個與媒體關聯的文字軌道對應一個。然後,TextTrack.cues 屬性返回一個包含該特定軌道 cue 的 TextTrackCueList。
js
const video = document.getElementById("video");
video.onplay = () => {
console.log(video.textTracks[0].cues);
};
規範
| 規範 |
|---|
| HTML # texttrackcuelist |
瀏覽器相容性
載入中…