HTML <track> Tag
The <track> tag defines subtitles, captions, descriptions, chapters, or metadata for either <audio> or <video> media element. The tag is a child tag of these tags.
Syntax
<[audio | video]>
...
<track src="...">
...
</[audio | video]>
The closing tag (</track>) is not obligatory.
Example
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
video {
width: 300px;
height: 200px;
border: 1px solid #666;
}
</style>
</head>
<body>
<video controls muted src="/build/videos/arcnet.io(7-sec).mp4">
<track default kind="subtitles" srclang="en" src="/build/videos/arcnet.io(7-sec).mp4"/>
</video>
<p>Some information about video</p>
</body>
</html>
Attributes
Attribute | Value | Description |
---|---|---|
default | default | Specifies that the track should be enabled unless the user's preferences indicate that another track is more appropriate. This is used on one track element per media element. |
kind | Defines the kind of text track. | |
captions | Translation of dialogue and sound effects. | |
chapters | Chapter titles for better navigation. | |
descriptions | A textual description of the video content. | |
metadata | Content used by scripts ( not visible for the user). | |
subtitles | Subtitles in a video. | |
label | text | Specifies a user-readable title of the text track |
src | URL | Sets the path of the track. |
srclang | language_code | Sets the language of the track text data (must be defined if kind = "subtitles"). |
The <track> tag also supports the Global attributes and the Event Attributes.
0 Comments
CAN FEEDBACK
Emoji