VTTCue: snapToLines-Eigenschaft
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since Januar 2020.
Die snapToLines-Eigenschaft der VTTCue-Schnittstelle ist ein Boolean, der angibt, ob die VTTCue.line-Eigenschaft eine ganzzahlige Anzahl von Zeilen oder ein Prozentsatz der Videogröße ist.
Wert
Ein Boolean.
Beispiele
Im folgenden Beispiel wird ein neues VTTCue erstellt, dann wird der Wert von snapToLines auf true gesetzt. Der Wert 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!");
cue.snapToLines = true;
console.log(cue.snapToLines);
track.addCue(cue);
Spezifikationen
| Specification |
|---|
| WebVTT: The Web Video Text Tracks Format> # dom-vttcue-snaptolines> |
Browser-Kompatibilität
Loading…