HTML and CSS Reference
In-Depth Information
Subtitles
are a transcription or translation of dialogue, for cases when the sound is available but
may not be understood, especially if it's in another language.
Captions
are a transcription of dialogue but also describe any other sounds, music cues, or other
essential audio information. Unlike subtitles, captions are intended as a replacement for the audio
if the audio isn't available, especially valuable to deaf viewers.
Descriptions
provide text descriptions of a video if the video isn't available, or for blind users, in
which case the text descriptions might be synthesized as audible speech or printed to a Braille
device.
Chapters
are titles meant to act as navigation points, to jump to a particular segment of the media
source, like the scene selection on a DVD.
Metadata
is information about the media, only intended for use by scripts or user-agents, not for
display.
The
track
element has an optional
srclang
attribute to declare the language of the text track. If the
track's
kind
is set to subtitles, a
srclang
attribute must be present, though it may have an empty value
(
srclang=""
) meaning the track has no language. An optional
label
attribute offers a title for each text
track, which could appear in a menu so your users can select one track from several options.
This is all brand new in HTML5, and is still very much in a state of flux as the specification marches toward
completion. As of this writing, only a few of the very latest browsers have implemented support for the
track
element, but we can hope others add it soon. We've tried to boil it down to a brief introduction here,
and although the markup is simple, actually implementing text tracks for rich media is a much more
complex matter. One major tangle is defining and standardizing the format of the timed text tracks
themselves, and that part is still ongoing.
Required Attributes
src
: The URL of the text track data.
Optional Attributes
kind
: The kind of text track, specified by one of the keywords:
subtitles
,
captions
,
descriptions
,
chapters
, or
metadata
. The track's
kind
defaults to
subtitles
if the attribute
is missing.
srclang
: The language of the text track, specified by a valid language tag (see
langtag.net
for
more on language tags). This attribute must be present if the
track
element's
kind
is
subtitles
, though
srclang
may have an empty value (in which case the track has no specified
language).
label
: A human-readable title for the text track, to assist the user in selecting which track to
render. This is especially helpful when there are multiple tracks.
default
: Indicates the default text track for the media element when there is more than one
track. This attribute can only appear in one
track
element per media element.