/

HTML / CSS / JavaScript Tutorial

HTML Element: <track>

[this page | pdf | back links]

The HTML <track> element indicates a text track for a media element, i.e. a <video> or <audio>. It is new in HTML 5. It is used to specify subtitles, captions or other files containing text that should be visible when the media is playing.

 

The attributes it can take (in addition to HTML global attributes and HTML event attributes) are:

 

Attribute

Description

More

default

Default track / command to be enabled unless user preferences specify otherwise

Here

kind

Kind of text track

Here

label

Title / label of track or command or group of commands

Here

src

URL of track file

Here

srclang

Language of track text data

Here

 

To create or access such an element in JavaScript see here. The corresponding HTML DOM object supports standard DOM properties and methods, and additional properties with the same name and meaning as the attributes of the underlying HTML element referred to above. It also supports the following additional properties and methods:

 

Property

Description

More

readyState

Returns current state of track resource

Here

track

Returns TextTrack object representing the text track data of the track element

Here

 

The default style applicable to this element is shown here.

 


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile