Skip to content

Instantly share code, notes, and snippets.

@brettgaylor
Created June 16, 2011 17:48
Show Gist options
  • Select an option

  • Save brettgaylor/1029791 to your computer and use it in GitHub Desktop.

Select an option

Save brettgaylor/1029791 to your computer and use it in GitHub Desktop.
Popcorn 101
<!doctype html>
<html>
<head>
<span id="popcorn-js"><script src="http://popcornjs.org/code/dist/popcorn-complete.min.js"></script></span>
<script>
<span id="eventlistener">// ensure the web page (DOM) has loaded
document.addEventListener("DOMContentLoaded", function () {</span>
<span id="popcorninstance">// Create a popcporn instance by calling Popcorn("#id-of-my-video")
var pop = Popcorn("#ourvideo");</span>
// add a footnote at 2 seconds, and remove it at 6 seconds
<span id="footnote">pop.footnote({</span>
<span id="time">start: 2,
end: 6,</span>
<span id="text">text: "Pop!",</span>
<span id="target">target: "footnotediv"</span>
});
<span id="play">// play the video right away
pop.play();</span>
}, false);
</script>
</head>
<body>
<span id="videotag"><video height="180" width="300" <span id="ourvideo">id="ourvideo"</span>><span id="sourcestag">
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.mp4"></source>
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.ogv"></source>
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.webm"></source></span>
</video></span>
<span id="footnotediv"><div id="footnotediv"></div></span>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment