VTTCue: text property

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.

* Some parts of this feature may have varying levels of support.

Thuộc tính text của giao diện VTTCue đại diện cho nội dung văn bản của cue.

Giá trị

Một chuỗi chứa văn bản thô của cue.

Ví dụ

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

track.addCue(cue);

Thông số kỹ thuật

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

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