Open syl22-00 opened 9 years ago
Hm, interesting.
How do we know for sure that the settimeout fires after it is paused? I also wonder what happened with youtube and chrome to cause this breakage.
The pauseVideo()
call does not change the state to paused
, so we can not checked whether the video is actually paused after the timeout fires. One possibility could be to check if time changes or not, adding further delay. So I just assumed 0.2 seconds is safe enough.
As for what happened to Youtube (nothing probably changed on Chrome as issue is consistent across versions), I have no idea and did not find anything. But the issue has been here for more than a week I think.
Yeah, it does seem like something changed on YouTube's end, which doesn't surprise me at all. It sounds like a bug on YouTube's end.
What happens if you delay this call by 0-200 ms https://github.com/pculture/popcorn-js/blob/master/wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js#L248
Delaying the call to pause does not fix the missing pause event.
Actually my fix was really wrong (the parameter sent to onFirstPause was actually not sent) but was still working because the pause call is apparently synchronous, unlike the call to seek
, which the onFirstPause
function makes sure completes before proceeding. So I updated the fix, completely taking out waiting for that event. It works well on Chrome and Firefox.
I'm not super comfortable with accepting this yet, until we have a better idea why this broke.
That might give us more insight, and lead us to a cleaner fix.
Right now it is actually just circumventing the pause event completely.
This is not necessary anymore as youtube seems to have fixed the missing event.
This is a fix for issue #458 where the pause event is not fired in Youtube HTML on Chrome, meaning that player initialization does not complete.