Skip to content

Closed captioning

Scott Miller edited this page Mar 17, 2016 · 2 revisions

The MediaPlayer uses the standard W3C tracks element. If the MediaPlayer's video tag has track elements, the MediaPlayer will automatically display UI to allow the user to turn on and off captions as well as see which captions are currently enabled.

Below is a code example:

HTML
<div id="myMediaPlayer">
<video src="http://www.contoso.com/video.mp4">
<track src="captions.vtt" label="English" kind="captions" srclang="en-us" default>
</video>
</div>

JavaScript

var mediaPlayer = new TVJS.MediaPlayer(document.getElementById("myMediaPlayer"));