The HTML kind attribute is used in the <track> element to specify the category or purpose of text track data.
Definition and Usage
➔ The <track> element is used inside the <audio> and <video> elements.
➔ The kind attribute has the following possible values:
- subtitle: Text track that provides a translation of the dialogue and relevant sound effects in the video.
- caption: Text track with dialogue, sound effects, and cues of music in the video.
- description: Text track with textual descriptions of video or audio content for blind or visually impaired users.
- chapter: Text track used for navigation within the list of chapter titles for user.
- metadata: Text tracks used by scripts and this data is not displayed to the user.
Syntax
//In HTML
<video controls width="550">
<source src="myvideo.mp4" type="video/mp4">
<track id="trackSubEn" src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="captions_en.vtt" kind="captions" srclang="en" label="English_Captions">
Your browser does not support the video tag.
</video>
//In JavaScript
<script>
let trackSubEn = document.getElementById("trackSubEn");
trackSubEn.kind = "subtitles";
trackSubEn.kind = "captions";
trackSubEn.setAttribute("kind", "descriptions");
</script>