A TTML plugin for video.js
This plugin makes it possible use TTML text tracks on VideoJS.
Download videojs-ttml and include it in your page along with video.js. To use this plugin you must set nativeTextTracks
to false
:
<video id="example-video" width=600 height=300 class="video-js vjs-default-skin" controls>
<source
src="http://example.com/index.mp4"
type="video/mp4">
<track
src="http://example.com/captions.xml"
kind="captions"
srclang="en"
label="English Captions"
type="application/ttml+xml">
</video>
<script src="video.js"></script>
<script src="moment.js"></script>
<script src="videojs-ttml.js"></script>
<script>
var player = videojs('example-video', { plugins: { ttml: {} }, nativeTextTracks: false }, function() {
// Print a list of available textracks
console.log(this.textTracks());
});
</script>
This plugin requires moment.js.