files/en-us/web/api/vttcue/index.md
{{APIRef("WebVTT")}}
The VTTCue interface of the WebVTT API represents a cue that can be added to the text track associated with a particular video (or other media).
A cue defines the text to display in a particular timeslice of a video or audio track, along with display properties such as its size, alignment, and position.
{{InheritanceDiagram}}
VTTCue object that covers the given time range and has the given text.This interface also inherits properties from {{domxref("TextTrackCue")}}.
null if none is assigned.true if the {{domxref("VTTCue.line")}} attribute indicates an integer number of lines or false if it represents a percentage of the video size.
This is true by default.auto or a number whose interpretation depends on the value of {{domxref("VTTCue.snapToLines")}}.auto, a number representing the percentage of the {{domxref("VTTCue.region")}}, or the video size if {{domxref("VTTCue.region")}} is null.auto.The following example adds a new {{domxref("TextTrack")}} to the video, then adds cues using the {{domxref("TextTrack.addCue()")}} method, with a VTTCue object as the value.
<video controls src="/shared-assets/videos/friday.mp4"></video>
video {
width: 420px;
height: 300px;
}
let video = document.querySelector("video");
let track = video.addTextTrack("captions", "Captions", "en");
track.mode = "showing";
track.addCue(new VTTCue(0, 0.9, "Hildy!"));
track.addCue(new VTTCue(1, 1.4, "How are you?"));
track.addCue(new VTTCue(1.5, 2.9, "Tell me, is the lord of the universe in?"));
track.addCue(new VTTCue(3, 4.2, "Yes, he's in - in a bad humor"));
track.addCue(new VTTCue(4.3, 6, "Somebody must've stolen the crown jewels"));
console.log(track.cues);
{{EmbedLiveSample('Example','400','330')}}
{{Specifications}}
{{Compat}}