VTTCue: snapToLines property
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Thuộc tính snapToLines của giao diện VTTCue là một Boolean cho biết thuộc tính VTTCue.line là số nguyên dòng hay phần trăm kích thước video.
Giá trị
Một Boolean.
Ví dụ
Trong ví dụ sau, một VTTCue mới được tạo, sau đó giá trị của snapToLines được đặt thành true. Giá trị sau đó được in ra console.
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);
Thông số kỹ thuật
| Specification |
|---|
| WebVTT: The Web Video Text Tracks Format> # dom-vttcue-snaptolines> |