docs.rodeo

MDN Web Docs mirror

HTMLTrackElement

{{ APIRef("HTML DOM") }} 

The HTMLTrackElement interface represents an {{Glossary("HTML")}}  {{HTMLElement("track")}}  element within the {{Glossary("DOM")}} . This element can be used as a child of either {{HTMLElement("audio")}}  or {{HTMLElement("video")}}  to specify a text track containing information such as closed captions or subtitles.

{{InheritanceDiagram}} 

Instance properties

Inherits properties from its parent, {{domxref("HTMLElement")}} .

Instance methods

No specific method; inherits methods from its parent, {{domxref("HTMLElement")}} .

Events

Inherits events from its parent, {{domxref("HTMLElement")}} .

Listen to these events using {{domxref("EventTarget/addEventListener", "addEventListener()")}}  or by assigning an event listener to the oneventname property of this interface:

Usage notes

Loading of the track’s text resource

The WebVTT or TTML data describing the actual cues for the text track isn’t loaded if the track’s {{domxref("TextTrack.mode", "mode")}}  is initially in the disabled state. If you need to be able to perform any processing on the track after the <track> is set up, you should instead ensure that the track’s mode is either hidden (if you don’t want it to start out being presented to the user) or showing (to initially display the track). You can then change the mode as desired later.

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN