Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update byStart/byEnd padding when duration changes on a popcorn instance

  • Loading branch information...
commit 5c4de8efcaf89c1c80d667934c6551bc72c19d5b 1 parent d742ee4
@mjschranz authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 popcorn.js
View
14 popcorn.js
@@ -245,6 +245,20 @@
// Check for no duration info (NaN)
videoDurationPlus = duration != duration ? Number.MAX_VALUE : duration + 1;
+ self.on( "durationchange", function() {
+ var byEnd = self.data.trackEvents.byEnd,
+ byStart = self.data.trackEvents.byStart,
+ newDuration = self.duration(),
+ newEndPaddingDuration = newDuration != newDuration ? Number.MAX_VALUE : newDuration + 1;
+
+ byEnd.splice( byEnd.length - 1, 1 );
+ byStart.splice( byStart.length - 1, 1 );
+ Popcorn.addTrackEvent( self, {
+ start: newEndPaddingDuration,
+ end: newEndPaddingDuration
+ });
+ });
+
Popcorn.addTrackEvent( self, {
start: videoDurationPlus,
end: videoDurationPlus
Please sign in to comment.
Something went wrong with that request. Please try again.