![]() |
Definition and UsageThe This element is used to specify subtitles, caption files or other files containing text, that should be visible when the media is playing. Tracks are formatted in WebVTT format (.vtt files). Browser SupportThe numbers in the table specify the first browser version that fully supports the element. Optional Attributes
Global AttributesThe Event AttributesThe |
It is A video with subtitle tracks for two languages.
Example:
HTML
<video width="320" height="240" controls>
<source src="forrest_gump.mp4" type="video/mp4">
<source src="forrest_gump.ogg" type="video/ogg">
<track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>
It is A video with two subtitle tracks. "English" subtitle is the default.
The default
attribute is a boolean attribute.
When present, it specifies that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate.
Note: There must only be one <track>
element with a default
attribute per <media>
element.
The numbers in the table specify the first browser version that fully supports the attribute.
<track src="subtitles_en.vtt" default>
Example:
HTML
<video width="320" height="240" controls>
<source src="https://www.sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">
<source src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg" type="video/ogg">
<track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English" default>
<track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>
It is A video with two subtitle tracks.
Example:
HTML
<video width="320" height="240" controls>
<source src="https://www.sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">
<source src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg" type="video/ogg">
<track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>
It is A video with two subtitle tracks, both with a label defined.
The label
attribute specifies the title of the text track, and is used by the browser when listing available text tracks.
The numbers in the table specify the first browser version that fully supports the attribute.
<track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
Value | Description |
---|---|
label | Specifies the title of the text track |
Example:
HTML
<video width="320" height="240" controls>
<source src="https://www.sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">
<source src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg" type="video/ogg">
<track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>
It is A video with two subtitle tracks.
The required src
attribute specifies the URL of the track file.
Tracks are formatted in WebVTT format (.vtt files).
The numbers in the table specify the first browser version that fully supports the attribute.
<track src=URL>
Value | Description |
---|---|
URL | Specifies the URL of the track |
Example:
HTML
<video width="320" height="240" controls>
<source src="https://www.sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">
<source src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg" type="video/ogg">
<track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>
It is A video with two subtitle tracks.
The srclang
attribute specifies the language of the track text data.
This attribute is required if kind="subtitles"
.
Tip: To view all available language codes, go to our Language code reference.
The numbers in the table specify the first browser version that fully supports the attribute.
<track src="subtitles_en.vtt" kind="subtitles" srclang="en">
Value | Description |
---|---|
language_code | Specifies a two-letter language code that specifies the language of the track text data |
Example:
HTML
<video width="320" height="240" controls>
<source src="https://www.sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">
<source src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg" type="video/ogg">
<track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>
html track |
Read Full: | HTML Tag |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded: | 3 weeks ago |
Uploaded by: | Admin |
Views: | 61 |
Reffered: https://www.w3schools.com/tags/tag_track.asp