<html>
<body>
<video id="myVideo" width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
<p>Click the button to add a new text track.</p>
<button onclick="myFunction()">Try it</button>
<p><strong>Note:</strong> The addTextTrack method is not supported in any major browsers.</p>
<script>
var x = document.getElementById("myVideo");
function myFunction() {
var y = x.addTextTrack("caption");
y.addCue(new TextTrackCue("Test text", 01.000, 04.000,"","","", true));
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_video_addtexttrack by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:17:52 GMT -->
</html>