From 0d5c357a98dd048b1e60e7561087d134cbfc3ca0 Mon Sep 17 00:00:00 2001 From: Michelle Zhuo Date: Wed, 18 Oct 2017 15:43:10 -0700 Subject: [PATCH] Stop update images when livestream is paused Fixing: when a livestream is paused, we force the playhead back in if the playhead falls out of the seek range, which makes the paused image change. Now we'll jump when the user hits play. Closes #982. Change-Id: I3f9e05e15c710488477b70ea7642f007c771ea92 --- lib/media/playhead.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/media/playhead.js b/lib/media/playhead.js index be2cb9a7f1..e389121789 100644 --- a/lib/media/playhead.js +++ b/lib/media/playhead.js @@ -340,8 +340,13 @@ shaka.media.Playhead.prototype.onSeekingToStartTime_ = function() { * @private */ shaka.media.Playhead.prototype.onPollGapJump_ = function() { - if (this.video_.readyState == 0 || this.video_.seeking) - return; + // Don't gap jump before the video is ready to play. + if (this.video_.readyState == 0) return; + // Don't gap jump while seeking, to prevent a race condition. + if (this.video_.seeking) return; + // Don't gap jump while paused, so that you don't constantly jump ahead while + // paused on a livestream. + if (this.video_.paused) return; // When the ready state changes, we have moved on, so we should fire the large // gap event if we see one.