TextTrackCue: startTime 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.

Thuộc tính startTime của giao diện TextTrackCue trả về và đặt thời gian bắt đầu của cue.

Giá trị

Một số đại diện cho thời gian bắt đầu, tính bằng giây.

Ví dụ

Trong ví dụ sau, một VTTCue mới (kế thừa từ TextTrackCue) được tạo bắt đầu từ giây 0,1 và kết thúc vào giây 0,9. Thuộc tính startTime 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.1, 0.9, "Hildy!");
console.log(cue.startTime); // 0.1
track.addCue(cue);

Thông số kỹ thuật

Specification
HTML
# dom-texttrackcue-starttime

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