Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[#1117] Bug on trackstart and trackend while seeking backwards. #85

Merged
merged 2 commits into from

1 participant

ScottDowne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 67 additions and 12 deletions.
  1. +2 −2 popcorn.js
  2. +65 −10 test/popcorn.unit.js
4 popcorn.js
View
@@ -1200,7 +1200,7 @@
natives.end.call( obj, event, byStart );
obj.emit( trackend,
- Popcorn.extend({}, byEnd, {
+ Popcorn.extend({}, byStart, {
plugin: type,
type: trackend
})
@@ -1237,7 +1237,7 @@
natives.start.call( obj, event, byEnd );
obj.emit( trackstart,
- Popcorn.extend({}, byStart, {
+ Popcorn.extend({}, byEnd, {
plugin: type,
type: trackstart
})
75 test/popcorn.unit.js
View
@@ -2260,7 +2260,7 @@ test( "Start Zero Immediately", function() {
test( "Special track event listeners: trackstart, trackend", function() {
var $pop = Popcorn( "#video" ),
- expects = 4,
+ expects = 24,
count = 0;
expect( expects );
@@ -2285,24 +2285,79 @@ test( "Special track event listeners: trackstart, trackend", function() {
$pop.emitter({
start: 1,
- end: 3
+ end: 3,
+ direction: "forward"
+ }).emitter({
+ start: 4,
+ end: 6,
+ direction: "backward"
}).on( "trackstart", function( event ) {
- equal( event.type, "trackstart", "Special trackstart event object includes correct type" );
- plus();
+ if ( event.plugin === "cue" ) {
+ ok( !event.direction, "trackstart no plugin specific data on cue" );
+ plus();
+ equal( event._running, true, "cue event is running on trackstart" );
+ plus();
- equal( event.plugin, "emitter", "Special trackstart event object includes correct plugin name" );
- plus();
+ equal( event.type, "trackstart", "cue special trackstart event object includes correct type" );
+ plus();
+
+ equal( event.plugin, "cue", "cue special trackstart event object includes correct plugin name" );
+ plus();
+ } else if ( event.plugin === "emitter" ) {
+ ok( event.direction, "a direction exsists with plugin specific data going " + event.direction );
+ plus();
+
+ equal( event._running, true, "event is running on trackstart going " + event.direction );
+ plus();
+
+ equal( event.type, "trackstart", "Special trackstart event object includes correct type going " + event.direction );
+ plus();
+
+ equal( event.plugin, "emitter", "Special trackstart event object includes correct plugin name " + event.direction );
+ plus();
+ } else {
+ ok( false, "invalid plugin fired trackstart" );
+ plus();
+ }
}).on( "trackend", function( event ) {
- equal( event.type, "trackend", "Special trackend event object includes correct type" );
- plus();
+ if ( event.plugin === "cue" ) {
+ ok( !event.direction, "trackend no plugin specific data on cue" );
+ plus();
- equal( event.plugin, "emitter", "Special trackend event object includes correct plugin name" );
- plus();
+ equal( event._running, false, "cue event is not running on trackend" );
+ plus();
+
+ equal( event.type, "trackend", "cue special trackend event object includes correct type" );
+ plus();
+
+ equal( event.plugin, "cue", "cue special trackend event object includes correct plugin name" );
+ plus();
+ } else if ( event.plugin === "emitter" ) {
+ ok( event.direction, "a direction exsists with plugin specific data going " + event.direction );
+ plus();
+
+ equal( event._running, false, "event is not running on trackend going " + event.direction );
+ plus();
+
+ equal( event.type, "trackend", "Special trackend event object includes correct type " + event.direction );
+ plus();
+
+ equal( event.plugin, "emitter", "Special trackend event object includes correct plugin name " + event.direction );
+ plus();
+ } else {
+ ok( false, "invalid plugin fired trackend" );
+ }
+ }).cue( 4, function() {
+ $pop.pause().currentTime( 10 );
+ }).cue( 10, function() {
+ $pop.currentTime( 5 );
+ }).cue( 5, function() {
+ $pop.currentTime( 0 );
}).play();
});
Something went wrong with that request. Please try again.