Back to Content

TextTrackCue: track property

files/en-us/web/api/texttrackcue/track/index.md

latest757 B
Original Source

{{APIRef("WebVTT")}}

The track read-only property of the {{domxref("TextTrackCue")}} interface returns the {{domxref("TextTrack")}} object that this cue belongs to.

Value

A {{domxref("TextTrack")}} object.

Examples

In the following example a new {{domxref("VTTCue")}} (which inherits from TextTrackCue) is created, then added to a track. The value of track is printed to the console.

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.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}