Skip to content

Commit 41591c9

Browse files
committed
fix: Workaround for IE not seeking to exactly 0 during setup.
patch from mozilla#454
1 parent 8ae202a commit 41591c9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@
219219

220220
function onFirstPause() {
221221
removeYouTubeEvent( "pause", onFirstPause );
222-
if ( player.getCurrentTime() > 0 ) {
222+
// IE sometimes refuses to seek to exactly 0.
223+
var playerTime = player.getCurrentTime();
224+
if ( playerTime > 0 && !( playerTime < 0.2 && !impl.seeking && playerState === YT.PlayerState.PAUSED ) ) {
223225
setTimeout( onFirstPause, 0 );
224226
return;
225227
}
@@ -240,8 +242,8 @@
240242
return;
241243
}
242244
addYouTubeEvent( "pause", onFirstPause );
243-
player.seekTo( 0 );
244245
player.pauseVideo();
246+
player.seekTo( 0 );
245247
}
246248

247249
function addYouTubeEvent( event, listener ) {

0 commit comments

Comments
 (0)