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

[#1056] Fixed issue where vimeo was firing loadeddata prematurely #51

Merged
merged 1 commit into from May 7, 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
10 changes: 5 additions & 5 deletions players/vimeo/popcorn.vimeo.js
Expand Up @@ -49,8 +49,8 @@
vimeoObject = document.getElementById( vimeoContainer.id );

vimeo_player_loaded.seek[ vimeoContainer.id ] = function( time ) {
if( time !== currentTime ) {
currentTime = time;
if( time.seconds !== currentTime ) {
currentTime = time.seconds;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is because time is an object which contains duration, percentage, and seconds. I'm assuming we didn't notice this before because timeUpdate was firing so often that it update anyways.

media.dispatchEvent( "seeked" );
media.dispatchEvent( "timeupdate" );
}
Expand Down Expand Up @@ -206,11 +206,11 @@
}
});

media.dispatchEvent( "loadedmetadata" );
media.dispatchEvent( "loadeddata" );

media.duration = vimeoObject.api_getDuration();
media.dispatchEvent( "durationchange" );
media.dispatchEvent( "loadedmetadata" );
media.dispatchEvent( "loadeddata" );
volumeUpdate();
media.readyState = 4;
media.dispatchEvent( "canplaythrough" );
Expand Down Expand Up @@ -249,4 +249,4 @@
}
}
});
})();
})();
5 changes: 4 additions & 1 deletion players/vimeo/popcorn.vimeo.unit.js
Expand Up @@ -32,7 +32,7 @@ asyncTest( "Options Check", function() {
asyncTest( "Update Timer", function() {

var p2 = Popcorn.vimeo( "#player_1", "http://player.vimeo.com/video/11336811" ),
expects = 16,
expects = 17,
count = 0,
execCount = 0,
// These make sure events are only fired once
Expand Down Expand Up @@ -65,6 +65,9 @@ asyncTest( "Update Timer", function() {
p2.unlisten( "loadedmetadata" );
ok( true, "'loadedmetadata' fired" );
plus();
// make sure that we always have a duration at this point
ok( this.duration() > 0, "Videos duration is greather than 0" );
plus();
});

p2.listen( "durationchange", function() {
Expand Down