This presentation is an HTML5 website
Press → key to advance.
Having issues seeing the presentation? Read the disclaimer
Slides controls, press:

Start the video to watch popcorn.js change your webpage!
// Think something like...
aVideo.doesSomething({ at this time, with this information });
Evolved into...
// A Popcorn Video Object...
Popcorn("#video-id");
// ... does something, at this time, with this information
Popcorn("#video-id").doSomething({
start: 0,
end: 4,
info: "..."
});
This design makes Popcorn REALLY easy to extend...
var $pop = Popcorn("#an-id-selector");
So what does $pop look like?
{
data: {
events: {}, // Event handler data
trackEvents: {
// Array index corresponds to an integer
// ...which corresponds to a whole second
byEnd: [], // Queue of end functions (runs first)
byStart: [] // Queue of start functions
}
},
video: [object HTMLVideoElement],
__proto__: {
/*
Methods...
load, play, pause, currentTime, playbackRate, mute, volume,
roundTime, exec, trigger, listen, unlisten, getTrackEvents,
removeTrackEvent, removePlugin
*/
}
}
var $pop = Popcorn("#tron");
$pop.listen( "ended", function() {
// Show YouTube-like "Related Videos" screen
this.related({
list: [
"Tron",
"Matrix",
"Hackers"
]
});
}).exec( 4, function() {
this.pause();
if ( confirm("Wanna see more?") ) {
this.play();
} else {
this.currentTime(
this.duration() - 2
).play();
}
});
(function( Popcorn ) {
Popcorn.plugin( "comments", {
_setup: function( options ) {
// Do something immediately when the plugin is called
},
start: function( event, options ) {
// Fires at the specified start time
},
end: function( event, options ) {
// Fires at the specified end time
}
});
})( Popcorn );
Plugin Templates @ http://gul.ly/109
var $pop = Popcorn("#video");
$pop.wikipedia({
start: 6,
end: 15,
target: "output",
numberofwords: 150,
src: "http://en.wikipedia.org/wiki/Brendan_Eich"
});
[{
"image": {
"start": 0,
"end": 2,
"src":"src/json160.gif"
}
},
{
"footnote": {
"start": 0,
"end": 2,
"text":"I invented JSON"
}
},
{
"image": {
"start": 2,
"end": 10,
"src":"src/jslint.gif"
}
},
{
"footnote": {
"start": 2,
"end": 10,
"text":"I wrote JSLint"
}
}
]
<video id="crock-video" data-timeline-sources="playback.json">
<source src="src/crockford.ogv" type="video/ogg;" />
</video>
Popcorn( Popcorn.youtube( "whiplash", "http://www.youtube.com/watch?v=BYNoQZ5djUA" ) ); // Add a few commands with the footnote plugin...