Track Tag in HTML5
In this article I am going to describe about the implementation and use of Track Tag in HTML5.
Track Tag
The <track> tag is used to specify the position of beginning of a track of audio or a chapter of video. One or more track elements may be nested under one of the media elements, namely an <audio> tag or a <video> tag.
<track> tag is used in HTML5.Its use is optional.This tag was not used before as in HTML4.01.
HTML <track> tag specifies a subtitles, descriptions, chapters, metadata, captions that surrounding to <video> or <audio> tag.
Browser Support
This tag is not supported in any of the major browsers.
Attribute Value
Attribute |
Value |
Description |
default |
default |
Specifies track is enabled. |
kind |
captions
chapters
descriptions
metadata
subtitles
|
Specifies which kind of text track. |
label |
text |
Specifies title of track. |
src |
URL |
Required Attribute.Specifies the URL of the track. |
srclang |
Language Code |
Required Attribute.Specifies the language of the text track. |
Example of Track Tag in HTML5
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Track Tag</title>
</head>
<body>
<h2>Implementation of <track> Tag in HTML5</h2>
<video controls>
<source src="C:\Users\Public\Videos\Sample Videos\Wildlife.wmv" type="video/wmv">
<track src="Wildlife.vtt" label="English subtitles" kind="subtitles" srclang="en" default>
<track src="Wildlife.vtt" label="Hindi subtitles" kind="subtitles" srclang="hi">
Display this message, if your browser does not support video tag.
</video>
</body>
</html>
</body>
</html>
Output