HTML and CSS Reference
In-Depth Information
Figure I.6. JavaScript has been used to extract the text content of the normally invisible description track and
display it on the screen.
Before you dive into the code, review table I.3 , which lists the properties and methods of
the Text Track API.
Table I.3. The Text Track API
Name
Type
Description
kind
String property
The kind of text track, corresponds to the kind attribute.
label
String property
A human-readable label, corresponds to the label attribute.
language
String property
The language of the track, such as en-US, corresponds to the srclang attribute.
The mode of the track: DISABLED (the track will not be loaded), HIDDEN
(the track will be loaded but not displayed), or SHOWING (the track will be
loaded and displayed if appropriate).
mode
Integer property
cues
Array property
An array containing the individual cues from the track.
activeCues
Array property
An array containing the cues that apply to the current point in the media.
addCue()
Method
Add a cue to the cues array.
removeCue()
Method
Remove a cue from the cues array.
The property you need here is the activeCues array, or a set of cues that should be dis-
playing currently. Displaying the text from the active cue of the description track is
as simple as grabbing the first element of the array and using the text property, as shown
in the following listing. Replace the last case in the select statement in listing I.11 with
this one.
 
 
Search WWH ::




Custom Search