Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Multimedia captions HTML
<!DOCTYPE html >
<html>
<head>
<title>Popeye Script</title>
<script type="text/javascript">
// after elements are loaded
window.addEventListener("load", function () {
var trackElem = document.getElementById('enTrack');
var myCues = trackElem.track.cues;
for (i = 0; i < myCues.length; i++) {
//get the text of the cue
display.innerHTML += myCues[i].text + "<br>";
}
}, false);
</script>
</head>
<body>
<video id="video1" width="320" height="240" controls>
<source src="video/PopeyeForPresident_qtp.mp4" type="video/mp4">
<source src="video/PopeyeForPresident_qtp.ogv" type="video/ogg">
<track id="enTrack" src="video/engtrack.vtt" label="Popeye"
kind="captions" srclang="en" default>
<div>Your browser does not support HTML5 MPG4 video.</div>
</video>
<h3>Partial Script</h3>
<p id="display"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment