Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 2, 2014 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devdays/6abcb0cbef32fab8735a to your computer and use it in GitHub Desktop.
Save devdays/6abcb0cbef32fab8735a to your computer and use it in GitHub Desktop.
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