Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML <track> tag


May 05, 2021 HTML Reference Manual


Table of contents


HTML

The label is used as a child of the element and the element, which allows you to specify a timed text track (or time-based data) in webVTT format (.vtt file), refer to the following example:

Video with two subtitle tracks:

<video width="320" height="240" controls>
<source src="forrest_gump.mp4" type="video/mp4">
<source src="forrest_gump.ogg" type="video/ogg">
<track src="subtitles_en.vtt" kind="subtitles" src
label="English">
<track src="subtitles_no.vtt" kind="subtitles" srclang="no"
label="Norwegian">
</video>

Browser support

HTML <track> tag HTML <track> tag HTML <track> tag HTML <track> tag HTML <track> tag

IE 10, Opera, and Chrome support the hashtag.


Label definition and instructions for use

The label specifies an external text track for media elements such as the .lt;audio> and the "lt;video".

This element is used to specify subtitle files or other files that contain text that are visible when the media plays.

Tip: The type of data that track adds to the media element is set in the kind property, please refer to the list of optional properties below for the value of the kind property.


The difference between HTML 4.01 and HTML5

The label is the new label in HTML5.


Optional properties

New : The new property in HTML5.

Attributes value describe
default New default The track is default.If the user does not select any track, use the default track.
kind New captions
chapters
descriptions
metadata
subtitles
Specify the text type of text orbit.
label New text Specify the labels and titles of text tracks.
src New URL Required.Specify the URL of the track file.
srclang New language_code Specify the language of track text data.If the Kind property value is "subtitles", this property is required.

Global properties

The label supports the global properties of HTML.


The event property

The tag supports the event properties of HTML.


Related articles

HTML DOM Reference Manual: HTML DOM Track Object