VTTCue: lineAlign property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Thuộc tính lineAlign của giao diện VTTCue đại diện cho căn chỉnh của VTT cue này.

Giá trị

Một chuỗi chứa một trong các giá trị sau:

"start"

Căn chỉnh về đầu.

"center"

Căn chỉnh giữa.

"end"

Căn chỉnh về cuối.

Ví dụ

Trong ví dụ sau, một VTTCue mới được tạo, sau đó giá trị của lineAlign được đặt thành "center". 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.lineAlign = "center";
console.log(cue.lineAlign);

track.addCue(cue);

Thông số kỹ thuật

Specification
WebVTT: The Web Video Text Tracks Format
# dom-vttcue-linealign

Tương thích trình duyệt