VTTCue: getCueAsHTML() 方法
VTTCue 介面的 getCueAsHTML() 方法返回一個包含提示內容(cue content)的 DocumentFragment。
語法
js
getCueAsHTML()
引數
無。
返回值
一個 DocumentFragment。
示例
在下面的示例中,建立了一個新的 VTTCue。然後將作為文件片段的值列印到控制檯。
js
let video = document.querySelector("video");
let track = video.addTextTrack("captions", "Captions", "en");
track.mode = "showing";
let cue = new VTTCue(0, 0.9, "Hildy!");
console.log(cue.getCueAsHTML());
track.addCue(cue);
規範
| 規範 |
|---|
| WebVTT:網頁影片文字軌道格式 # dom-vttcue-getcueashtml |
瀏覽器相容性
載入中…