diff --git a/plugins/code/popcorn.code.html b/plugins/code/popcorn.code.html index 15335648..25e00d9b 100644 --- a/plugins/code/popcorn.code.html +++ b/plugins/code/popcorn.code.html @@ -10,6 +10,9 @@ document.addEventListener('DOMContentLoaded', function () { output = document.getElementById('output'); + var $ = function( id ) { + return document.getElementById( id.substring( 1 ) ); + }; var p = Popcorn('#video') @@ -17,7 +20,7 @@ start: 1, end: 3, onStart: function( options ) { - output.innerHTML = 'Test 1 - onStart (no onEnd)'; + $('#test1').innerHTML = 'Yes'; } }) @@ -25,10 +28,10 @@ start: 5, end: 8, onStart: function( options ) { - output.innerHTML = 'Test 2 - onStart'; + $('#test2a').innerHTML = 'Yes'; }, onEnd: function ( options ) { - output.innerHTML = 'Test 2 - onEnd'; + $('#test2b').innerHTML = 'Yes'; } }) @@ -36,13 +39,16 @@ start: 10, end: 14, onStart: function( options ) { - output.innerHTML = 'Test 3 - onStart [Frames: '; - }, - onFrame: function ( options ) { - output.innerHTML += '.'; + $('#test3a').innerHTML = 'Yes'; }, + onFrame: (function() { + var count = 0; + return function ( options ) { + $('#test3b').innerHTML = 'Yes (count = ' + ++count + ')'; + } + })(), onEnd: function ( options ) { - output.innerHTML += '] Test 3 - onEnd'; + $('#test3c').innerHTML = 'Yes'; } }) @@ -76,7 +82,15 @@
Test | Completed |
---|---|
Test 1 - onStart (1s) | No |
Test 2a - onStart (5s) | No |
Test 2b - onEnd (8s) | No |
Test 3a - onStart (10s) | No |
Test 3b - onFrame (10s-14s) | No |
Test 3c - onEnd (14s) | No |