HTMLTrackElement: kind 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.
Thekind property of theHTMLTrackElement interface represents the type of track, or how the text track is meant to be used. It reflects the<track> element's enumeratedkind attribute.
If nokind is set,subtitles is used. If the attribute is not set to one of the valid enumerated values, it is invalid andmetadata is used. Other valid values includecaptions,descriptions, andchapters.
In this article
Value
A string; lowercasecaptions,descriptions,chapters,subtitles ormetadata.
Example
Given the following:
html
<track src="track.vtt" />We get the following results:
js
const trackElement = document.getElementById("exampleTrack");// missing valueconsole.log(trackElement.kind); // "subtitles"trackElement.kind = "INVALID";// invalid valueconsole.log(trackElement.kind); // "metadata"trackElement.kind = "CAPTIONS";// valid valueconsole.log(trackElement.kind); // "captions"Specifications
| Specification |
|---|
| HTML> # dom-track-kind> |