From 41591c911b05421f2164772dcaabfc31db0a4ad2 Mon Sep 17 00:00:00 2001 From: Plou Date: Tue, 9 Aug 2016 14:13:12 +0200 Subject: [PATCH] fix: Workaround for IE not seeking to exactly 0 during setup. patch from https://github.com/mozilla/popcorn-js/pull/454 --- wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js b/wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js index 4aeadba39..e2436263b 100644 --- a/wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js +++ b/wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js @@ -219,7 +219,9 @@ function onFirstPause() { removeYouTubeEvent( "pause", onFirstPause ); - if ( player.getCurrentTime() > 0 ) { + // IE sometimes refuses to seek to exactly 0. + var playerTime = player.getCurrentTime(); + if ( playerTime > 0 && !( playerTime < 0.2 && !impl.seeking && playerState === YT.PlayerState.PAUSED ) ) { setTimeout( onFirstPause, 0 ); return; } @@ -240,8 +242,8 @@ return; } addYouTubeEvent( "pause", onFirstPause ); - player.seekTo( 0 ); player.pauseVideo(); + player.seekTo( 0 ); } function addYouTubeEvent( event, listener ) {