Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[#945814] Time changes properly after source changes. #364

Open
wants to merge 1 commit into from

2 participants

@ScottDowne
Owner

No description provided.

@happyworm

Reviewed and it seems to work in my tests on Chrome and Firefox with both the HTML and Flash YouTube players. More details on Bugzilla: 945814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 10, 2013
  1. @ScottDowne
This page is out of date. Refresh to see the latest.
View
8 wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js
@@ -102,7 +102,7 @@
self._util.type = "YouTube";
function addMediaReadyCallback( callback ) {
- mediaReadyCallbacks.unshift( callback );
+ mediaReadyCallbacks.push( callback );
}
function onPlayerReady( event ) {
@@ -279,14 +279,18 @@
if( !( playerReady && player ) ) {
return;
}
+ onPause();
durationReady = false;
+ mediaReady = false;
firstPlay = false;
+ loopedPlay = false;
+ impl.currentTime = 0;
+ mediaReadyCallbacks = [];
clearInterval( currentTimeInterval );
clearInterval( bufferedInterval );
player.stopVideo();
player.clearVideo();
player.destroy();
- mediaReadyCallbacks = [];
elem = document.createElement( "div" );
}
View
10 wrappers/youtube/popcorn.HTMLYouTubeVideoElement.unit.js
@@ -99,7 +99,7 @@ var testData = {
}
});
- asyncTest( "YouTube 06 - source changes", 2, function() {
+ asyncTest( "YouTube 06 - source changes", 3, function() {
var video = testData.createMedia( "#video" );
@@ -107,8 +107,14 @@ var testData = {
ok( true, "first source ready event is fired" );
video.removeEventListener( "loadedmetadata", loadedmetadata, false );
video.addEventListener( "loadedmetadata", function() {
+ video.pause();
ok( true, "second source ready event is fired" );
- start();
+ video.addEventListener( "play", function() {
+ equal( video.currentTime, 2, "times change properly after source changes" );
+ start();
+ }, false );
+ video.currentTime = 2;
+ video.play();
}, false );
video.src = "http://www.youtube.com/watch?v=HMnyrTe-j6U&autoplay=1&loop=1";
}, false );
Something went wrong with that request. Please try again.