Skip to content

Commit

Permalink
Implemented the pause feature for T308
Browse files Browse the repository at this point in the history
  • Loading branch information
aljohnson1 committed Oct 7, 2011
1 parent 9e10ca0 commit 301a310
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
20 changes: 11 additions & 9 deletions plugins/footnote/popcorn.footnote.html
Expand Up @@ -2,22 +2,24 @@
<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()
.play()
.footnote({
start: 5, // seconds
end: 15, // seconds
pause: 5, // Pause feature.
text: 'This video made exclusively for drumbeat.org',
target: 'footnotediv'
} )
.footnote({
start: 20, // seconds
end: 45, // seconds
pause: 5,
text: 'Visit webmademovies.org for more details',
target: 'footnotediv'
} )
Expand All @@ -31,22 +33,22 @@ <h1 id="qunit-header">Popcorn Footnote 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'
<video id='video'
controls preload='none'
width= '250px'
poster="../../test/poster.png">
poster="../../test/poster.png">

<source id='mp4'
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
type='video/mp4; codecs="avc1, mp4a"'>

<source id='ogv'
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
type='video/ogg; codecs="theora, vorbis"'>

<p>Your user agent does not support the HTML5 Video element.</p>
<p>Your user agent does not support the HTML5 Video element.</p>

</video>
</video>
</div>
<div id="footnotediv" width="50%" height="50%">
</div>
Expand Down
2 changes: 2 additions & 0 deletions plugins/footnote/popcorn.footnote.js
Expand Up @@ -26,6 +26,8 @@
*/

Popcorn.forEach( [ "footnote", "text" ], function( name ) {



Popcorn.plugin( name , {

Expand Down
26 changes: 25 additions & 1 deletion popcorn.js
Expand Up @@ -763,6 +763,7 @@

track.start = Popcorn.util.toSeconds( track.start, obj.options.framerate );
track.end = Popcorn.util.toSeconds( track.end, obj.options.framerate );
//track.pause = Popcorn.util.toSeconds( track.pause,obj.options.framerate); // new pause feature.

// Store this definition in an array sorted by times
var byStart = obj.data.trackEvents.byStart,
Expand Down Expand Up @@ -978,8 +979,24 @@
if ( byStart.end > currentTime &&
byStart._running === false &&
obj.data.disabled.indexOf( type ) === -1 ) {

//--------------------------------------------------------------------
byStart._running = true;

if ( byStart.pause ) {
window.setTimeout(function(){
obj.play();
}, byStart.pause );
obj.pause();
}


// if ( tracks.pause ) {
// window.setTimeout(function(){
// obj.play();
// }, tracks.pause );
// obj.pause();
// }

natives.start.call( obj, event, byStart );

// If the `frameAnimation` option is used,
Expand Down Expand Up @@ -1141,7 +1158,11 @@
Popcorn.registryByName = {};
// An interface for extending Popcorn
// with plugin functionality


Popcorn.plugin = function( name, definition, manifest ) {

//alert("Pluging function for start");

if ( Popcorn.protect.natives.indexOf( name.toLowerCase() ) >= 0 ) {
Popcorn.error( "'" + name + "' is a protected function name" );
Expand Down Expand Up @@ -1224,6 +1245,9 @@
// Checks for expected properties
if ( !( "start" in options ) ) {
options.start = 0;

alert("checking start option");

}

if ( !( "end" in options ) ) {
Expand Down

0 comments on commit 301a310

Please sign in to comment.