HTML/Elements/track

From Web Education Community Group
< 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.
    • metadatas
      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.srt srclang=en label="English">
 <track kind=captions src=brave.en.srt srclang=en label="English for the Hard of Hearing">
 <track kind=subtitles src=brave.fr.srt srclang=fr label="Français">
 <track kind=subtitles src=brave.de.srt srclang=de label="Deutsch">
</video>


HTML reference

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


See also