VTTCue: getCueAsHTML()-Methode
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Die getCueAsHTML()
-Methode der VTTCue
-Schnittstelle gibt ein DocumentFragment
zurück, das den Inhalt des Cues enthält.
Syntax
js
getCueAsHTML()
Parameter
Keine.
Rückgabewert
Ein DocumentFragment
.
Beispiele
Im folgenden Beispiel wird ein neuer VTTCue
erstellt. Der Wert als Dokumentfragment wird dann in der Konsole ausgegeben.
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);
Spezifikationen
Specification |
---|
WebVTT: The Web Video Text Tracks Format # dom-vttcue-getcueashtml |