C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
HTML <track> tagHTML <track> tag is used to define time-based text tracks for a media file. The <track> tag must use as child element of <audio> and <video> elements. The <track> tag is used to add subtitle, caption, or any other form of text which displayed when a media file plays. HTML <track> is new tag in HTML5. Syntax
<track src=" " kind=" " srclang=" " label=" ">
Following are some specifications about the HTML <track> tag
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML track Tag</title>
</head>
<body>
<h2>Example of track tag</h2>
<video controls="controls">
<source src="flower.mp4" type="video/mp4">
<track src="flower.vtt" kind="subtitles" srclang="en" label="English">
Sorry!Your browser does not support the track
</video>
</body>
</html>
In the above example, we have used flower.vtt file to add subtitle in the video file. Following is the flower.vtt file:
How to create WEBVTT file:
Following are some basic steps to create WEBVTT file for <track> tag:
Now your WEBVTT file is ready to use. Attribute:
Tag-specific attributes:
Global attribute:The <track> tag supports the Global attributes in HTML. Event attribute:The <track> tag supports the Event attributes in HTML. Supporting Browsers
Next TopicHTML tt Tag
|