HTML Element <track> Example
The HTML element <track>
is used to specify a text track for <audio>
and <video>
elements.
A text track can be a caption, subtitle, or other files containing the text that should be visible when the media playing.
Usually, the tracks are formatted in WebVTT format with the file extension of .vtt
.
Here is an example that explains the element in action. Click the below link to see the live demo.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example - HTML Element track</title>
</head>
<body>
<video controls="controls">
<source src="/assets/videos/shuttle.mp4" type="video/mp4">
<source src="/assets/videos/shuttle.ogv" type="video/ogg">
<track src="/assets/videos/subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
Oops, Your browser does not support the HTML5 Video element.
</video>
</body>
</html>