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
track element allows authors to specify explicit external timed text tracks for media elements.”
kind: lol why is this not called “type”
srclang: BCP 47 language tag
label: user-visible title for track
default: 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 audio
captions: overlaid on video; more complete transcription of dialog and sounds, that could be considered complete enough for the hard-of-hearing to rely on
descriptions: “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
- Doesn’t have an end tag or ARIA roles.
- A media element (
audio) can only have one each of a track element with:
kindattribute determined to be
captions, and with
chapters, default. I interpret the spec to mean that these conditions can be met when the
kindattribute defaults to
subtitles, instead of having to be explicitly set, but that is just an interpretation.
- Can have as many
kindattribute as you want!
- One use case for multiple track elements is the option to have subtitles/captions in different languages.