VTTCue: position 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 position của giao diện VTTCue đại diện cho độ thụt lề của cue trong dòng.
Giá trị
Một số, hoặc "auto" đại diện cho độ thụt lề của cue trong dòng.
Ví dụ
Trong ví dụ sau, một VTTCue mới được tạo, sau đó giá trị của position được đặt thành 2. 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.position = "2";
console.log(cue.position);
track.addCue(cue);
Thông số kỹ thuật
| Specification |
|---|
| WebVTT: The Web Video Text Tracks Format> # dom-vttcue-position> |