<pclass="legacydocsnote">This documentation is for an outdated version of Video.js. See <ahref="https://docs.videojs.com/tutorial-video-tracks.html">documentation for the current release</a>.
<p>Video Tracks are a function of HTML5 video for providing a selection of alternative video tracks to the user, so that they can change type of video they want to watch. Video.js makes video tracks work across all browsers. There are currently six types of tracks:</p>
<ul>
<li><strong>Alternative</strong>: an alternative video representation of the main video track</li>
<li><strong>Captions</strong>: The main video track with burned in captions</li>
<li><strong>Main</strong>: the main video track</li>
<li><strong>Sign</strong>: the main video track with added sign language overlay</li>
<li><strong>Subtitles</strong>: the main video track with burned in subtitles</li>
<li><strong>Commentary</strong>: the main video track with burned in commentary</li>
<li>It is currently impossible to add VideoTracks in a non-programtic way</li>
<li>Literal switching of VideoTracks for playback is not handled by video.js and must be handled by something else. video.js only stores the track representation</li>
<li>There is currently no UI implementation of VideoTracks</li>
</ul>
<h2id="adding-to-video-js">Adding to Video.js</h2>
<blockquote>
<p>Right now adding video tracks in the HTML is unsupported. Video Tracks must be added programatically.</p>
</blockquote>
<p>You must add video tracks <ahref="#api">programatically</a> for the time being.</p>
<h2id="attributes">Attributes</h2>
<p>Video Track propertites and settings</p>
<h3id="kind">kind</h3>
<p>One of the five track types listed above. Kind defaults to empty string if no kind is included, or an invalid kind is used.</p>
<h3id="label">label</h3>
<p>The label for the track that will be show to the user, for example in a menu that list the different languages available for video tracks.</p>
<h3id="language">language</h3>
<p>The two-letter code (valid BCP 47 language tag) for the language of the video track, for example "en" for English. A list of language codes is <ahref="languages.md#language-codes">available here</a>.</p>
<h3id="selected">selected</h3>
<p>If this track should be playing or not. Trying to select more than one track will cause other tracks to be deselected.</p>
<h2id="interacting-with-video-tracks">Interacting with Video Tracks</h2>
<h3id="doing-something-when-a-track-becomes-enabled">Doing something when a track becomes enabled</h3>
<p>When a new track is enabled (other than the main track) an event is fired on the <code>VideoTrackList</code> called <code>change</code> you can listen to that event and do something with it.
Here's an example:</p>
<pre><codeclass="lang-js">// get the current players VideoTrackList object