Skip to main content

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: required
  • 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 subtitles.

Other notes:

  • Doesn’t have an end tag or ARIA roles.
  • A media element (video or audio) can only have one each of a track element with: kind attribute determined to be subtitles or captions, and with default attribute true; kind attribute as description, default; kind attribute as chapters, default. I interpret the spec to mean that these conditions can be met when the kind attribute defaults to subtitles, instead of having to be explicitly set, but that is just an interpretation.
  • Can have as many track elements with metadata in the kind attribute as you want!
  • One use case for multiple track elements is the option to have subtitles/captions in different languages.

Responses

My blog uses Webmentions. Responses from Mastodon and other sites that send Webmentions will show up here.

No Webmentions have been sent to this post yet.