// reference to the window context
(function(global) {
-
// Cache refs to speed up calls to native utils
var
forEach = Array.prototype.forEach,
})()
);
+ Popcorn.extend(Popcorn.p, {
+
+ setCommand: function() {
+
+ },
+ getCommand: function() {
+
+ },
+ toTrack: function( setup ) {
+ /*
+ {
+ in: ts,
+ out: ts,
+ command: f()
+ }
+ */
+ // stores the command in a track
+ }
+
+ });
+
var nativeEvents = "loadstart progress suspend emptied stalled play pause " +
"loadedmetadata loadeddata waiting playing canplay canplaythrough " +
"seeking seeked timeupdate ended ratechange durationchange volumechange";
}, false);
}
-
return this;
+ },
+ special: {
+ // handles timeline controllers
+ play: function () {
+ // renders all of the interally stored track commands
+ }
}
}
};
Popcorn.extend( Popcorn.p, plugin );
-
if ( Popcorn.registry ) {
Popcorn.registry.push({
name: name,
});
}
- // within the context of a plugin, the `timeupdate` or any of the events can be listened to
+ // within the context of a plugin
+ // any of the events can be listened to
};
global.Popcorn = Popcorn;
-})(window);
\ No newline at end of file
+})(window);
<!DOCTYPE html>
<html>
<head>
- <title>Popcorn API DEMO</title>
+ <title>Popcorn API Draft DEMO</title>
<script src="jquery.js"></script>
<script src="../popcorn-api-draft.js"></script>
<script src="demo.js"></script>
</head>
<body>
- <h1 id="qunit-header">Popcorn API</h1>
+ <h1 id="qunit-header">Popcorn API Draft</h1>
<style>
/* test positioning */
</video>
</div>
-
-
-
-
-
-
</body>
</html>
-
// EXAMPLE PLUGIN: SUBTITLER
(function (Popcorn) {
-
-
-
Popcorn.plugin( "subtitler" , function ( options ) {
var subtitles = [],
context = this.video,
div = document.getElementById("subtitle-container");
-
// Check for existing frame
if ( !div ) {
this.listen("timeupdate", function (event) {
-
Popcorn.forEach(subtitles, function ( subtitle ) {
var temp = div.querySelectorAll( subtitle.id );
});
}
}
-
}, this);
});
});
$(function () {
-
-
var p = Popcorn('#video');
-
p.play();
-
+
p.subtitler({
id: "#subtitle-a",
start: 2, // seconds
html: '<p id="subtitle-a">Appear at 2 second mark, dissappear at 5 second mark</p>'
});
-
-
// Butter would generate the data to populate this api function call's argument
p.subtitler([
-});
\ No newline at end of file
+});