Skip to content

Commit

Permalink
[#959367] Ensure duration changes pot the padding event at duration p…
Browse files Browse the repository at this point in the history
…lus one.
  • Loading branch information
ScottDowne committed Jan 14, 2014
1 parent 9345245 commit 65a2629
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions popcorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
if ( !self.isDestroyed ) {
self.data.durationChange = function() {
var newDuration = self.media.duration,
newDurationPlus = newDuration + 1,
byStart = self.data.trackEvents.byStart,
byEnd = self.data.trackEvents.byEnd;

Expand All @@ -279,13 +280,13 @@
// References to byEnd/byStart are reset, so accessing it this way is
// forced upon us.
self.data.trackEvents.byEnd.push({
start: newDuration,
end: newDuration
start: newDurationPlus,
end: newDurationPlus
});

self.data.trackEvents.byStart.push({
start: newDuration,
end: newDuration
start: newDurationPlus,
end: newDurationPlus
});
};

Expand Down
8 changes: 4 additions & 4 deletions test/popcorn.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,10 +1050,10 @@ asyncTest( "durationchange", 7, function() {

equal( byStart.length, 2, "byStart should only contain the padding trackevents" );
equal( byEnd.length, 2, "byEnd should only contain the padding trackevents" );
ok( byStart[ 1 ].end === 10, "Padding event value should be equal to new duration. byStart.end" );
ok( byStart[ 1 ].start === 10, "Padding event value should be equal to new duration. byStart.start" );
ok( byEnd[ 1 ].end === 10, "Padding event value should be equal to new duration. byEnd.end" );
ok( byEnd[ 1 ].start === 10, "Padding event value should be equal to new duration. byEnd.start" );
ok( byStart[ 1 ].end === 11, "Padding event value should be equal to new duration. byStart.end" );
ok( byStart[ 1 ].start === 11, "Padding event value should be equal to new duration. byStart.start" );
ok( byEnd[ 1 ].end === 11, "Padding event value should be equal to new duration. byEnd.end" );
ok( byEnd[ 1 ].start === 11, "Padding event value should be equal to new duration. byEnd.start" );

Popcorn.removePlugin( "durationPlugin" );
pop.destroy();
Expand Down

0 comments on commit 65a2629

Please sign in to comment.