--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn footnote Plug-in Demo</title>
+
+ <script src="../../popcorn.js"></script>
+ <script src="popcorn.footnote.js"></script>
+ <script>
+ document.addEventListener('DOMContentLoaded', function () {
+ var p = Popcorn('#video')
+ .play()
+ .footnote({
+ start: 5, // seconds
+ end: 15, // seconds
+ text: 'This video made exclusively for drumbeat.org',
+ target: 'footnotediv'
+ } )
+ .footnote({
+ start: 20, // seconds
+ end: 45, // seconds
+ text: 'Visit webmademovies.org for more details',
+ target: 'footnotediv'
+ } )
+
+ }, false);
+
+ </script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn Footnore Plug-in Demo</h1>
+ <p> A footnote displaying This video made exclusively for drumbeat.org' will appear at 5 seconds and disappear at 15 seconds.</p>
+ <p> A footnote displaying 'Visit webmademovies.org for more details' will appear at 20 seconds and disappear at 45 seconds.</p>
+ <div>
+ <video id='video'
+ controls preload='none'
+ width= '250px'
+ poster="../../test/poster.png">
+
+ <source id='mp4'
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id='ogv'
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ </div>
+ <div id="footnotediv" width="50%" height="50%">
+ </div>
+</body>
+</html>
--- /dev/null
+// PLUGIN: WEBPAGE
+
+(function (Popcorn) {
+
+ /**
+ * Footnote popcorn plug-in
+ * Adds text to an element on the page.
+ * Options parameter will need a start, end, target and text.
+ * Start is the time that you want this plug-in to execute
+ * End is the time that you want this plug-in to stop executing
+ * Text is the text that you want to appear in the target
+ * Target is the id of the document element that the text needs to be
+ * attached to, this target element must exist on the DOM
+ *
+ * Note: anything in the target element will be overwritten by the text
+ * specified by the user
+ * @param {Object} options
+ *
+ * Example:
+ var p = Popcorn('#video')
+ .footnote({
+ start: 5, // seconds
+ end: 15, // seconds
+ text: 'This video made exclusively for drumbeat.org',
+ target: 'footnotediv'
+ } )
+ *
+ */
+ Popcorn.plugin( "footnote" , (function(){
+
+ var temp;
+
+ return {
+ /**
+ * @member webpage
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
+ * options variable
+ */
+ start: function(event, options){
+ temp = document.getElementById( options.target );
+ temp.innerHTML = options.text;
+ },
+ /**
+ * @member webpage
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
+ * options variable
+ */
+ end: function(event, options){
+ temp.innerHTML = "";
+ }
+
+ };
+
+ })());
+
+})( Popcorn );
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn API</title>
+ <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
+ <script src="../../test/qunit/qunit.js"></script>
+ <!--
+ do not move - this must be called immediately prior to
+ popcorn-api-draft.js
+ -->
+
+ <script src="../../popcorn.js"></script>
+ <script src="popcorn.footnote.js"></script>
+
+ <script src="popcorn.footnote.unit.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn Footnote Plugin</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"> </div>
+
+ <video id='video'
+ controls preload='none'
+ width= '250px'
+ poster="../../test/poster.png">
+
+ <source id='mp4'
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id='ogv'
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ <div id="footnotediv"></div>
+</body>
+</html>
--- /dev/null
+test("Popcorn Footnote Plugin", function () {
+
+ var popped = Popcorn("#video"),
+ expects = 5,
+ count = 0,
+ iframeInterval,
+ iframeInterval2,
+ iframeInterval3,
+ iframeInterval4;
+
+ expect(expects);
+
+ function plus() {
+ if ( ++count===expects) {
+ start();
+ }
+ }
+
+ stop();
+
+ ok ('footnote' in popped, "footnote is a mehtod of the popped instance");
+ plus();
+
+ ok ( document.getElementById('footnotediv').innerHTML === "", "initially, there is nothing inside the footnotediv" );
+ plus();
+
+ popped.footnote({
+ start: 5, // seconds
+ end: 15, // seconds
+ text: 'This video made exclusively for drumbeat.org',
+ target: 'footnotediv'
+ } )
+ .footnote({
+ start: 35, // seconds
+ end: 45, // seconds
+ text: 'Visit webmademovies.org for more details',
+ target: 'footnotediv'
+ } )
+ .play();
+
+
+ interval = setInterval( function() {
+ if( popped.currentTime() > 5 && popped.currentTime() <= 15 ) {
+ ok (document.getElementById('footnotediv').innerHTML === "This video made exclusively for drumbeat.org", "footnote displaing correct information" );
+ plus();
+ clearInterval( interval );
+ }
+ }, 5000);
+
+ interval2 = setInterval( function() {
+ if( popped.currentTime() > 15 && popped.currentTime() < 35 ) {
+ ok (document.getElementById('footnotediv').innerHTML === "", "footnote cleared properly" );
+ plus();
+ clearInterval( interval2 );
+ }
+ }, 5000);
+
+ interval3 = setInterval( function() {
+ if( popped.currentTime() > 35 && popped.currentTime() < 45 ) {
+ ok (document.getElementById('footnotediv').innerHTML === "Visit webmademovies.org for more details", "footnote displaing correct information" );
+ plus();
+ clearInterval( interval3 );
+ }
+ }, 5000);
+
+});