Skip to content

Instantly share code, notes, and snippets.

Created December 2, 2014 00:24
What would you like to do?
Multimedia captions HTML
<!DOCTYPE html >
<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);
<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>
<h3>Partial Script</h3>
<p id="display"></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment