VTTCue: getCueAsHTML() メソッド
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
getCueAsHTML() は VTTCue インターフェイスのメソッドで、このキューの内容を含んだ DocumentFragment を返します。
構文
js
getCueAsHTML()
引数
なし。
返値
DocumentFragment です。
例
次の例では、新しい VTTCue が作成されます。そして、文書フラグメントとしての値がコンソールに出力されます。
js
let video = document.querySelector("video");
let track = video.addTextTrack("captions", "Captions", "en");
track.mode = "showing";
let cue1 = new VTTCue(0, 0.9, "Hildy!");
console.log(cue1.getCueAsHTML());
track.addCue(cue1);
仕様書
| Specification |
|---|
| WebVTT: The Web Video Text Tracks Format> # dom-vttcue-getcueashtml> |
ブラウザーの互換性
Loading…