Day 93 of 100DaysOfSpec, the track element
I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.
UAs = user agents = browsers, etc.
4.7.9 The track element
“The track
element allows authors to specify explicit external timed text tracks for media elements.”
kind
: lol why is this not called “type”src
: requiredsrclang
: BCP 47 language taglabel
: user-visible title for trackdefault
: enable this track in absence of user preference overrides
Keywords that can be used for the kind
attribute include:
subtitles
: overlaid on video when it’s hard to understand the audiocaptions
: overlaid on video; more complete transcription of dialog and sounds, that could be considered complete enough for the hard-of-hearing to rely ondescriptions
: “synthesized as audio”; descriptions of the visual video portion, for when those visuals are unavailable or unusable for whatever reason.chapters
: chapter titles for navigating through the video, which the UA interface displays as an interactive list.metadata
: not displayed; “tracks intended for use from script”
Default value, if the kind
attribute is missing, is subtitles
.
Other notes:
- Doesn’t have an end tag or ARIA roles.
- A media element (
video
oraudio
) can only have one each of a track element with:kind
attribute determined to besubtitles
orcaptions
, and withdefault
attribute true;kind
attribute asdescription
,default
;kind
attribute aschapters
, default. I interpret the spec to mean that these conditions can be met when thekind
attribute defaults tosubtitles
, instead of having to be explicitly set, but that is just an interpretation. - Can have as many
track
elements withmetadata
in thekind
attribute as you want! - One use case for multiple track elements is the option to have subtitles/captions in different languages.