MDN self-hosted library · e01.org

TextTrackCue: track property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const video = document.querySelector("video");
const captionTrack = video.addTextTrack("captions", "Captions", "en");
captionTrack.mode = "showing";

const cue = new VTTCue(0, 0.9, "Hildy!");
captionTrack.addCue(cue);
console.log(cue.track); // a TextTrack object.