Skip to content
This repository has been archived by the owner on Jun 29, 2018. It is now read-only.

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

Merged
merged 2 commits into from Jun 5, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions popcorn.js
Expand Up @@ -1200,7 +1200,7 @@
natives.end.call( obj, event, byStart );

obj.emit( trackend,
Popcorn.extend({}, byEnd, {
Popcorn.extend({}, byStart, {
plugin: type,
type: trackend
})
Expand Down Expand Up @@ -1237,7 +1237,7 @@
natives.start.call( obj, event, byEnd );

obj.emit( trackstart,
Popcorn.extend({}, byStart, {
Popcorn.extend({}, byEnd, {
plugin: type,
type: trackstart
})
Expand Down
75 changes: 65 additions & 10 deletions test/popcorn.unit.js
Expand Up @@ -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 );
Expand All @@ -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();
});

Expand Down