HTML/Elements/track

From W3C Wiki
< HTML‎ | Elements
Jump to: navigation, search

<track>

The <track> element allows authors to specify explicit external timed tracks for media elements. It does not represent anything on its own.

HTML Attributes

  • kind = subtitles/ captions/ descriptions/ chapters/ metadata
    • subtitles
      Transcription or translation of the dialogue, suitable for when the sound is available but not understood
    • captions
      Transcription or translation of the dialogue, sound effects, relevant musical cues, and other relevant audio information, suitable for when the soundtrack is unavailable
    • descriptions
      Textual descriptions of the video component of the media resource, intended for audio synthesis when the visual component is unavailable
    • chapters
      Chapter titles, intended to be used for navigating the media resource.
    • metadata
      Tracks intended for use from script.


  • src = valid non-empty URL potentially surrounded by spaces
    Gives the address of the timed track data.
    This attribute must be present.


  • charset = character encoding name


  • srclang = valid BCP47 language tag.
    Gives the language of the timed track data.
    This attribute must be present if the element's kind attribute is in the subtitles state.


  • label = string
    Gives a user-readable title for the track.


See also global attributes.


Examples

This video has subtitles in several languages:

<video src="brave.webm">
 <track kind=subtitles src=brave.en.vtt srclang=en label="English">
 <track kind=captions src=brave.en.hoh.vtt srclang=en label="English for the Hard of Hearing">
 <track kind=subtitles src=brave.fr.vtt srclang=fr lang=fr label="Français">
 <track kind=subtitles src=brave.de.vtt srclang=de lang=de label="Deutsch">
</video>

(The lang attributes on the last two describe the language of the label attribute, not the language of the subtitles themselves. The language of the subtitles is given by the srclang attribute.)

HTML reference

This element was introduced in HTML5 - 4.8.9 The track element.


See also