From adfbb234a9b6d1f3951561bc02535639cb80fe3b Mon Sep 17 00:00:00 2001 From: Richard Thompson Date: Tue, 9 Jun 2015 12:40:54 +0100 Subject: [PATCH 01/14] Added _trustZeroes flag so enterBuffering sentinel doesn't activate when we go to zero unexpectedly --- static/script/devices/mediaplayer/html5.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/script/devices/mediaplayer/html5.js b/static/script/devices/mediaplayer/html5.js index 0fbc4031..80814534 100644 --- a/static/script/devices/mediaplayer/html5.js +++ b/static/script/devices/mediaplayer/html5.js @@ -49,6 +49,7 @@ require.def( this._super(); this._setSentinelLimits(); this._state = MediaPlayer.STATE.EMPTY; + }, /** @@ -56,6 +57,7 @@ require.def( */ setSource: function(mediaType, url, mimeType) { if (this.getState() === MediaPlayer.STATE.EMPTY) { + this._trustZeroes = false; this._type = mediaType; this._source = url; this._mimeType = mimeType; @@ -410,9 +412,11 @@ require.def( return; } else if (this._postBufferingState === MediaPlayer.STATE.PAUSED) { + this._trustZeroes = false; this._toPaused(); } else { + this._trustZeroes = false; this._toPlaying(); } }, @@ -524,6 +528,7 @@ require.def( }, _toBuffering: function() { + this._trustZeroes = true; this._state = MediaPlayer.STATE.BUFFERING; this._emitEvent(MediaPlayer.EVENT.BUFFERING); this._setSentinels([ this._exitBufferingSentinel ]); @@ -578,7 +583,7 @@ require.def( _enterBufferingSentinel: function() { var notFirstSentinelActivationSinceStateChange = this._sentinelIntervalNumber > 1; - if(!this._hasSentinelTimeChanged && !this._nearEndOfMedia && notFirstSentinelActivationSinceStateChange) { + if(!this._hasSentinelTimeChanged && !this._nearEndOfMedia && notFirstSentinelActivationSinceStateChange && this.doBuffering) { this._emitEvent(MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); this._toBuffering(); return true; @@ -678,6 +683,7 @@ require.def( this._sentinelInterval = setInterval(function() { self._sentinelIntervalNumber += 1; var newTime = self.getCurrentTime(); + self.doBuffering = newTime > 0 || self._trustZeroes; self._hasSentinelTimeChanged = (Math.abs(newTime - self._lastSentinelTime) > 0.2); self._nearEndOfMedia = (self.getDuration() - (newTime || self._lastSentinelTime)) <= 1; self._lastSentinelTime = newTime; From 03b8fdd1a512d967b66b0716b147c920eda206e5 Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Thu, 11 Jun 2015 14:31:40 +0100 Subject: [PATCH 02/14] Add tests for 'trust zeroes' in enter buffering sentinel. Make _doBuffering private --- .../devices/mediaplayer/html5commontests.js | 44 ++++++++++++++++++- static/script/devices/mediaplayer/html5.js | 5 ++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index f7b1f2c6..5bf8ae0d 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1254,6 +1254,48 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; + mixins.testEnterBufferingSentinelDoesNothingWhenDeviceTimeIsZero = function(queue) { + expectAsserts(2); + var self = this; + runMediaPlayerTest(this, queue, function (MediaPlayer) { + getToPlaying(self, MediaPlayer, 0); + clearEvents(self); + + var i; + for (i = 0; i<3; i++) { + advancePlayTime(self); + fireSentinels(self); + } + + for (i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertState(self, MediaPlayer.STATE.PLAYING); + }); + }; + + mixins.testEnterBufferingSentinelDoesNothingWhenSeekedToZeroAndDeviceTimeIsZero = function(queue) { + expectAsserts(1); + var self = this; + runMediaPlayerTest(this, queue, function (MediaPlayer) { + getToPlaying(self, MediaPlayer, 20); + clearEvents(self); + + self._mediaPlayer.playFrom(0); + deviceMockingHooks.finishBuffering(self._mediaPlayer); + fireSentinels(self); + + for (var i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + }); + }; + mixins.testExitBufferingSentinelCausesTransitionToPlayingWhenPlaybackStarts = function(queue) { expectAsserts(3); var self = this; @@ -1963,7 +2005,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye assertEquals(stubCreateElementResults.video, this._mediaPlayer.getPlayerElement()); }); }; - + mixins.testGetPlayerElementReturnsAudioElementForAudio = function(queue) { expectAsserts(1); runMediaPlayerTest(this, queue, function (MediaPlayer) { diff --git a/static/script/devices/mediaplayer/html5.js b/static/script/devices/mediaplayer/html5.js index 80814534..0eda9e04 100644 --- a/static/script/devices/mediaplayer/html5.js +++ b/static/script/devices/mediaplayer/html5.js @@ -583,7 +583,7 @@ require.def( _enterBufferingSentinel: function() { var notFirstSentinelActivationSinceStateChange = this._sentinelIntervalNumber > 1; - if(!this._hasSentinelTimeChanged && !this._nearEndOfMedia && notFirstSentinelActivationSinceStateChange && this.doBuffering) { + if(!this._hasSentinelTimeChanged && !this._nearEndOfMedia && notFirstSentinelActivationSinceStateChange && this._doBuffering) { this._emitEvent(MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); this._toBuffering(); return true; @@ -683,10 +683,11 @@ require.def( this._sentinelInterval = setInterval(function() { self._sentinelIntervalNumber += 1; var newTime = self.getCurrentTime(); - self.doBuffering = newTime > 0 || self._trustZeroes; + self._doBuffering = newTime > 0 || self._trustZeroes; self._hasSentinelTimeChanged = (Math.abs(newTime - self._lastSentinelTime) > 0.2); self._nearEndOfMedia = (self.getDuration() - (newTime || self._lastSentinelTime)) <= 1; self._lastSentinelTime = newTime; + for (var i = 0; i < sentinels.length; i++) { var sentinelActivated = sentinels[i].call(self); if(sentinelActivated) { From 3b1c29279bae7c4c83d2499e5c35a2ba0576b0e5 Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Thu, 11 Jun 2015 16:02:01 +0100 Subject: [PATCH 03/14] Removed interval check tolerance for enter buffering sentinel --- .../devices/mediaplayer/html5commontests.js | 33 ++++++++++++++++++- static/script/devices/mediaplayer/html5.js | 16 +++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index 5bf8ae0d..f48969ea 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1296,6 +1296,37 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; + mixins.testEnterBufferingSentinelDoesNothingWhenTimeAdvancesByLessThanTheBufferingTolerance = function(queue) { + expectAsserts(2); + var self = this; + runMediaPlayerTest(this, queue, function (MediaPlayer) { + getToPlaying(self, MediaPlayer, 0); + clearEvents(self); + + var i; + for (i = 0; i<3; i++) { + advancePlayTime(self); + fireSentinels(self); + } + + for (i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + stubCreateElementResults.video.currentTime = 0.01; + fireSentinels(self); + + advancePlayTime(); + fireSentinels(self); + + advancePlayTime(); + fireSentinels(self); + + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertState(self, MediaPlayer.STATE.PLAYING); + }); + } + mixins.testExitBufferingSentinelCausesTransitionToPlayingWhenPlaybackStarts = function(queue) { expectAsserts(3); var self = this; @@ -2005,7 +2036,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye assertEquals(stubCreateElementResults.video, this._mediaPlayer.getPlayerElement()); }); }; - + mixins.testGetPlayerElementReturnsAudioElementForAudio = function(queue) { expectAsserts(1); runMediaPlayerTest(this, queue, function (MediaPlayer) { diff --git a/static/script/devices/mediaplayer/html5.js b/static/script/devices/mediaplayer/html5.js index 0eda9e04..18b16802 100644 --- a/static/script/devices/mediaplayer/html5.js +++ b/static/script/devices/mediaplayer/html5.js @@ -582,8 +582,20 @@ require.def( }, _enterBufferingSentinel: function() { - var notFirstSentinelActivationSinceStateChange = this._sentinelIntervalNumber > 1; - if(!this._hasSentinelTimeChanged && !this._nearEndOfMedia && notFirstSentinelActivationSinceStateChange && this._doBuffering) { + var currentTime = this.getCurrentTime(); + + var enterBufferingSentinelTimeChanged = Math.abs(currentTime - this._lastEnteringBufferingSentinelTime) > 0; + var activateEnterBufferingSentinel; + + if (this._lastEnteringBufferingSentinelTime == undefined || enterBufferingSentinelTimeChanged) { + activateEnterBufferingSentinel = false; + } + else { + activateEnterBufferingSentinel = !this._nearEndOfMedia && this._doBuffering; + } + this._lastEnteringBufferingSentinelTime = currentTime; + + if(activateEnterBufferingSentinel ) { this._emitEvent(MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); this._toBuffering(); return true; From b4c26783193e523fbe06614fcfb2da7cecdcb61e Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Fri, 12 Jun 2015 10:24:17 +0100 Subject: [PATCH 04/14] Refactored enter buffering sentinel to only fire on second attempt. Refactored related tests --- .../devices/mediaplayer/html5commontests.js | 30 ++++++++++++++----- static/script/devices/mediaplayer/html5.js | 26 ++++++++++------ 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index f48969ea..3cb4c758 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -262,6 +262,17 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye assert(self._eventCallback.notCalled); }; + var assertEventTypeHasBeenFiredASpecificNumberOfTimes = function (self, eventType, expectedNumberOfCalls) { + var numberOfCalls = 0; + + for( i = 0; i < self._eventCallback.args.length; i++) { + if(eventType === self._eventCallback.args[i][0].type) { + numberOfCalls++; + } + } + assertEquals(expectedNumberOfCalls, numberOfCalls); + }; + var clearEvents = function(self) { self._eventCallback.reset(); }; @@ -1124,6 +1135,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye clearEvents(self); fireSentinels(self); fireSentinels(self); + fireSentinels(self); assertEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); assertEvent(self, MediaPlayer.EVENT.BUFFERING); @@ -1254,7 +1266,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; - mixins.testEnterBufferingSentinelDoesNothingWhenDeviceTimeIsZero = function(queue) { + mixins.testEnterBufferingSentinelDoesNothingWhenDeviceTimeIsReportedAsZeroDuringPlayback = function(queue) { expectAsserts(2); var self = this; runMediaPlayerTest(this, queue, function (MediaPlayer) { @@ -1296,8 +1308,8 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; - mixins.testEnterBufferingSentinelDoesNothingWhenTimeAdvancesByLessThanTheBufferingTolerance = function(queue) { - expectAsserts(2); + mixins.testEnterBufferingSentinelOnlyFiresOnSecondAttempt = function(queue) { + expectAsserts(3); var self = this; runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlaying(self, MediaPlayer, 0); @@ -1313,17 +1325,21 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye stubCreateElementResults.video.currentTime = 0; fireSentinels(self); } + + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + stubCreateElementResults.video.currentTime = 0.01; fireSentinels(self); - advancePlayTime(); + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + + stubCreateElementResults.video.currentTime = 0.01; fireSentinels(self); - advancePlayTime(); + stubCreateElementResults.video.currentTime = 0.01; fireSentinels(self); - assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); - assertState(self, MediaPlayer.STATE.PLAYING); + assertEventTypeHasBeenFiredASpecificNumberOfTimes(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING, 1); }); } diff --git a/static/script/devices/mediaplayer/html5.js b/static/script/devices/mediaplayer/html5.js index 18b16802..352a158a 100644 --- a/static/script/devices/mediaplayer/html5.js +++ b/static/script/devices/mediaplayer/html5.js @@ -582,22 +582,30 @@ require.def( }, _enterBufferingSentinel: function() { - var currentTime = this.getCurrentTime(); + var shouldSentinelFire = !this._hasSentinelTimeChanged && !this._nearEndOfMedia && this._doBuffering; - var enterBufferingSentinelTimeChanged = Math.abs(currentTime - this._lastEnteringBufferingSentinelTime) > 0; - var activateEnterBufferingSentinel; + if (this._enterBufferingSentinelAttemptCount === undefined) { + this._enterBufferingSentinelAttemptCount = 0; + } - if (this._lastEnteringBufferingSentinelTime == undefined || enterBufferingSentinelTimeChanged) { - activateEnterBufferingSentinel = false; + if(shouldSentinelFire) { + this._enterBufferingSentinelAttemptCount++; } - else { - activateEnterBufferingSentinel = !this._nearEndOfMedia && this._doBuffering; + + if (this._enterBufferingSentinelAttemptCount == 1) { + shouldSentinelFire = false; } - this._lastEnteringBufferingSentinelTime = currentTime; - if(activateEnterBufferingSentinel ) { + if(shouldSentinelFire) { this._emitEvent(MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); this._toBuffering(); + /* Resetting the sentinel attempt count to zero means that the sentinel will only fire once + even if multiple iterations result in the same conditions. + This should not be needed as the second iteration, when the enter buffering sentinel is fired + will cause the media player to go into the buffering state. The enter buffering sentinel is not fired + when in buffering state + */ + this._enterBufferingSentinelAttemptCount = 0; return true; } return false; From 2a664347bfc5501de096d99fea0c02f3a4595845 Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Fri, 12 Jun 2015 14:37:21 +0100 Subject: [PATCH 05/14] Refactored trust zeros so that they are trusted on all flavours of playback, and untrusted in sentinel firing when time is not zero. --- .../devices/mediaplayer/html5commontests.js | 12 +++---- static/script/devices/mediaplayer/html5.js | 31 +++++++++++++------ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index 3cb4c758..9478d037 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1288,7 +1288,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; - mixins.testEnterBufferingSentinelDoesNothingWhenSeekedToZeroAndDeviceTimeIsZero = function(queue) { + mixins.testEnterBufferingSentinelFiresWhenSeekedToZeroAndDeviceTimeIsReportedAsZeroForAtLeastTwoIntervals = function(queue) { expectAsserts(1); var self = this; runMediaPlayerTest(this, queue, function (MediaPlayer) { @@ -1299,16 +1299,14 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye deviceMockingHooks.finishBuffering(self._mediaPlayer); fireSentinels(self); - for (var i=0; i<2; i++) { - stubCreateElementResults.video.currentTime = 0; - fireSentinels(self); - } + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); - assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); }); }; - mixins.testEnterBufferingSentinelOnlyFiresOnSecondAttempt = function(queue) { + mixins.testEnterBufferingSentinelOnlyFiresOnSecondAttemptWhenDeviceReportsTimeAsNotChangingWithinTolerance = function(queue) { expectAsserts(3); var self = this; runMediaPlayerTest(this, queue, function (MediaPlayer) { diff --git a/static/script/devices/mediaplayer/html5.js b/static/script/devices/mediaplayer/html5.js index 352a158a..e190e09d 100644 --- a/static/script/devices/mediaplayer/html5.js +++ b/static/script/devices/mediaplayer/html5.js @@ -121,6 +121,7 @@ require.def( switch (this.getState()) { case MediaPlayer.STATE.PAUSED: case MediaPlayer.STATE.COMPLETE: + this._trustZeroes = true; this._toBuffering(); this._playFromIfReady(); break; @@ -130,6 +131,7 @@ require.def( break; case MediaPlayer.STATE.PLAYING: + this._trustZeroes = true; this._toBuffering(); this._targetSeekTime = this._getClampedTimeForPlayFrom(seconds); if (this._isNearToCurrentTime(this._targetSeekTime)) { @@ -154,6 +156,7 @@ require.def( this._sentinelSeekTime = undefined; switch (this.getState()) { case MediaPlayer.STATE.STOPPED: + this._trustZeroes = true; this._toBuffering(); this._mediaElement.play(); break; @@ -174,6 +177,7 @@ require.def( switch (this.getState()) { case MediaPlayer.STATE.STOPPED: + this._trustZeroes = true; this._toBuffering(); this._playFromIfReady(); break; @@ -412,11 +416,8 @@ require.def( return; } else if (this._postBufferingState === MediaPlayer.STATE.PAUSED) { - this._trustZeroes = false; this._toPaused(); - } else { - this._trustZeroes = false; this._toPlaying(); } }, @@ -528,7 +529,6 @@ require.def( }, _toBuffering: function() { - this._trustZeroes = true; this._state = MediaPlayer.STATE.BUFFERING; this._emitEvent(MediaPlayer.EVENT.BUFFERING); this._setSentinels([ this._exitBufferingSentinel ]); @@ -582,7 +582,11 @@ require.def( }, _enterBufferingSentinel: function() { - var shouldSentinelFire = !this._hasSentinelTimeChanged && !this._nearEndOfMedia && this._doBuffering; + var shouldSentinelFire = !this._hasSentinelTimeChangedWithinTolerance && !this._nearEndOfMedia ; + + if (this.getCurrentTime() === 0) { + shouldSentinelFire = this._trustZeroes && shouldSentinelFire; + } if (this._enterBufferingSentinelAttemptCount === undefined) { this._enterBufferingSentinelAttemptCount = 0; @@ -622,7 +626,7 @@ require.def( return fireExitBufferingSentinel(this); } - if (this._hasSentinelTimeChanged) { + if (this._hasSentinelTimeChangedWithinTolerance) { return fireExitBufferingSentinel(this); } return false; @@ -652,7 +656,7 @@ require.def( _shouldBePausedSentinel: function() { var sentinelActionTaken = false; - if (this._hasSentinelTimeChanged) { + if (this._hasSentinelTimeChangedWithinTolerance) { var mediaElement = this._mediaElement; sentinelActionTaken = this._nextSentinelAttempt(this._sentinelLimits.pause, function() { mediaElement.pause(); @@ -683,7 +687,7 @@ require.def( }, _endOfMediaSentinel: function() { - if (!this._hasSentinelTimeChanged && this._nearEndOfMedia) { + if (!this._hasSentinelTimeChangedWithinTolerance && this._nearEndOfMedia) { this._emitEvent(MediaPlayer.EVENT.SENTINEL_COMPLETE); this._onEndOfMedia(); return true; @@ -703,18 +707,25 @@ require.def( this._sentinelInterval = setInterval(function() { self._sentinelIntervalNumber += 1; var newTime = self.getCurrentTime(); - self._doBuffering = newTime > 0 || self._trustZeroes; - self._hasSentinelTimeChanged = (Math.abs(newTime - self._lastSentinelTime) > 0.2); + + self._hasSentinelTimeChangedWithinTolerance = (Math.abs(newTime - self._lastSentinelTime) > 0.2); self._nearEndOfMedia = (self.getDuration() - (newTime || self._lastSentinelTime)) <= 1; self._lastSentinelTime = newTime; for (var i = 0; i < sentinels.length; i++) { var sentinelActivated = sentinels[i].call(self); + + if (self.getCurrentTime() > 0) { + self._trustZeroes = false; + } + if(sentinelActivated) { break; } } }, 1100); + + }, _isReadyToPlayFrom: function() { From e7763a3b0570065c9e2c930c8e99feeba7ad6697 Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 09:25:32 +0100 Subject: [PATCH 06/14] Added test to ensure enter buffering sentinel fires when begin playback is called and zeroes are trusted --- .../devices/mediaplayer/html5commontests.js | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index 9478d037..69c5a93b 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1288,6 +1288,29 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; + mixins.testEnterBufferingSentinelFiresWhenBeginPlaybackIsCalledAndDeviceTimeIsReportedAsZeroForAtLeastTwoIntervals = function (queue) { + expectAsserts(2); + var self = this; + runMediaPlayerTest(this, queue, function (MediaPlayer) { + getToPlayingWithBeginPlayback(self, MediaPlayer, 20); + clearEvents(self); + + var i; + for (i = 0; i<3; i++) { + advancePlayTime(self); + fireSentinels(self); + } + + for (i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertState(self, MediaPlayer.STATE.PLAYING); + }); + }; + mixins.testEnterBufferingSentinelFiresWhenSeekedToZeroAndDeviceTimeIsReportedAsZeroForAtLeastTwoIntervals = function(queue) { expectAsserts(1); var self = this; @@ -1339,7 +1362,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye assertEventTypeHasBeenFiredASpecificNumberOfTimes(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING, 1); }); - } + }; mixins.testExitBufferingSentinelCausesTransitionToPlayingWhenPlaybackStarts = function(queue) { expectAsserts(3); From 50f2a8366ab3f939adf8ae21c21fde8a40d02ee9 Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 09:32:40 +0100 Subject: [PATCH 07/14] Renamed test to ensure that enter buffering sentinel does not fire --- .../devices/mediaplayer/html5commontests.js | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index 69c5a93b..0c8e863f 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1288,7 +1288,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; - mixins.testEnterBufferingSentinelFiresWhenBeginPlaybackIsCalledAndDeviceTimeIsReportedAsZeroForAtLeastTwoIntervals = function (queue) { + mixins.testEnterBufferingSentinelDoesNothingWhenBeginPlaybackIsCalledAndDeviceTimeIsReportedAsZeroForAtLeastTwoIntervals = function (queue) { expectAsserts(2); var self = this; runMediaPlayerTest(this, queue, function (MediaPlayer) { @@ -1364,6 +1364,29 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; + mixins.testEnterBufferingSentinelFiresWhenBeginPlaybackIsCalledAndDeviceTimeIsReportedAsZeroForAtLeastTwoIntervals = function (queue) { + expectAsserts(2); + var self = this; + runMediaPlayerTest(this, queue, function (MediaPlayer) { + getToPlayingWithBeginPlayback(self, MediaPlayer, 20); + clearEvents(self); + + var i; + for (i = 0; i<3; i++) { + advancePlayTime(self); + fireSentinels(self); + } + + for (i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertState(self, MediaPlayer.STATE.PLAYING); + }); + }; + mixins.testExitBufferingSentinelCausesTransitionToPlayingWhenPlaybackStarts = function(queue) { expectAsserts(3); var self = this; From de0c74936e20fc0610fa4f63a5009ded04490199 Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 09:34:07 +0100 Subject: [PATCH 08/14] Remove duplicate test --- .../devices/mediaplayer/html5commontests.js | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index 0c8e863f..ae247fb5 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1364,29 +1364,6 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; - mixins.testEnterBufferingSentinelFiresWhenBeginPlaybackIsCalledAndDeviceTimeIsReportedAsZeroForAtLeastTwoIntervals = function (queue) { - expectAsserts(2); - var self = this; - runMediaPlayerTest(this, queue, function (MediaPlayer) { - getToPlayingWithBeginPlayback(self, MediaPlayer, 20); - clearEvents(self); - - var i; - for (i = 0; i<3; i++) { - advancePlayTime(self); - fireSentinels(self); - } - - for (i=0; i<2; i++) { - stubCreateElementResults.video.currentTime = 0; - fireSentinels(self); - } - - assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); - assertState(self, MediaPlayer.STATE.PLAYING); - }); - }; - mixins.testExitBufferingSentinelCausesTransitionToPlayingWhenPlaybackStarts = function(queue) { expectAsserts(3); var self = this; From 71031bced78e15daf57012608ffe05b8d6597d61 Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 09:41:06 +0100 Subject: [PATCH 09/14] Added tests to ensure enter buffering sentinel fires when genuine buffer is needed --- .../devices/mediaplayer/html5commontests.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index ae247fb5..26cc6985 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1311,6 +1311,38 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; + mixins.testEnterBufferingSentinelFiresWhenBeginPlaybackFromZeroIsCalledAndDeviceTimeDoesNotAdvance = function(queue) { + expectAsserts(2); + var self = this; + runMediaPlayerTest(this, queue, function (MediaPlayer) { + getToPlaying(self, MediaPlayer, 0); + clearEvents(self); + + for (var i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + assertEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertState(self, MediaPlayer.STATE.BUFFERING); + }); + }; + + mixins.testEnterBufferingSentinelFiresWhenBeginPlaybackIsCalledAndDeviceTimeDoesNotAdvance = function(queue) { + expectAsserts(2); + var self = this; + runMediaPlayerTest(this, queue, function (MediaPlayer) { + getToPlayingWithBeginPlayback(self, MediaPlayer, 0); + clearEvents(self); + + for (var i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + assertEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertState(self, MediaPlayer.STATE.BUFFERING); + }); + }; + mixins.testEnterBufferingSentinelFiresWhenSeekedToZeroAndDeviceTimeIsReportedAsZeroForAtLeastTwoIntervals = function(queue) { expectAsserts(1); var self = this; From 654ddc2d4f22a20057ebc376145b4e47e0647830 Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 09:58:15 +0100 Subject: [PATCH 10/14] Refactor enter buffering sentinel tests to use helper functions --- .../devices/mediaplayer/html5commontests.js | 69 ++++++++----------- 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index 26cc6985..eb40dbde 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1266,25 +1266,37 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; + var ensureEnterBufferingSentinelIsNotCalled = function(self, MediaPlayer) { + var i; + for (i = 0; i<3; i++) { + advancePlayTime(self); + fireSentinels(self); + } + + for (i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertState(self, MediaPlayer.STATE.PLAYING); + }; + + var ensureEnterBufferingSentinelIsCalled = function(self, MediaPlayer) { + for (var i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + assertEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + assertState(self, MediaPlayer.STATE.BUFFERING); + }; + mixins.testEnterBufferingSentinelDoesNothingWhenDeviceTimeIsReportedAsZeroDuringPlayback = function(queue) { expectAsserts(2); var self = this; runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlaying(self, MediaPlayer, 0); clearEvents(self); - - var i; - for (i = 0; i<3; i++) { - advancePlayTime(self); - fireSentinels(self); - } - - for (i=0; i<2; i++) { - stubCreateElementResults.video.currentTime = 0; - fireSentinels(self); - } - assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); - assertState(self, MediaPlayer.STATE.PLAYING); + ensureEnterBufferingSentinelIsNotCalled(self, MediaPlayer); }); }; @@ -1294,20 +1306,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlayingWithBeginPlayback(self, MediaPlayer, 20); clearEvents(self); - - var i; - for (i = 0; i<3; i++) { - advancePlayTime(self); - fireSentinels(self); - } - - for (i=0; i<2; i++) { - stubCreateElementResults.video.currentTime = 0; - fireSentinels(self); - } - - assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); - assertState(self, MediaPlayer.STATE.PLAYING); + ensureEnterBufferingSentinelIsNotCalled(self, MediaPlayer); }); }; @@ -1317,13 +1316,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlaying(self, MediaPlayer, 0); clearEvents(self); - - for (var i=0; i<2; i++) { - stubCreateElementResults.video.currentTime = 0; - fireSentinels(self); - } - assertEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); - assertState(self, MediaPlayer.STATE.BUFFERING); + ensureEnterBufferingSentinelIsCalled(self, MediaPlayer); }); }; @@ -1333,13 +1326,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlayingWithBeginPlayback(self, MediaPlayer, 0); clearEvents(self); - - for (var i=0; i<2; i++) { - stubCreateElementResults.video.currentTime = 0; - fireSentinels(self); - } - assertEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); - assertState(self, MediaPlayer.STATE.BUFFERING); + ensureEnterBufferingSentinelIsCalled(self, MediaPlayer); }); }; From 05f3eb1852db63740f7ff70120c1ca6f3436890b Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 10:12:54 +0100 Subject: [PATCH 11/14] Add test to ensure pause sentinel is not called when device time increases by less than sentinel tolerance time --- .../tests/devices/mediaplayer/html5commontests.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index eb40dbde..caf83eea 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -2009,6 +2009,21 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; + mixins.testPauseSentinelDoesNotFireWhenDeviceTimeAdvancesByLessThanSentinelTolerance = function(queue) { + expectAsserts(1); + var self = this; + runMediaPlayerTest(this, queue, function(MediaPlayer) { + getToPlaying(self, MediaPlayer, 20); + clearEvents(self); + + self._mediaPlayer.pause(); + stubCreateElementResults.video.currentTime += 0.01; + fireSentinels(self); + + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_PAUSE); + }); + }; + mixins.testPlayFromNearCurrentTimeWillNotCauseFinishBufferingToPerformSeekLater = function(queue) { expectAsserts(1); runMediaPlayerTest(this, queue, function (MediaPlayer) { From f7a7acac41759466c2fe942b4840483bce58b3be Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 10:52:33 +0100 Subject: [PATCH 12/14] Renamed variable --- static/script/devices/mediaplayer/html5.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/static/script/devices/mediaplayer/html5.js b/static/script/devices/mediaplayer/html5.js index e190e09d..5e025003 100644 --- a/static/script/devices/mediaplayer/html5.js +++ b/static/script/devices/mediaplayer/html5.js @@ -582,25 +582,25 @@ require.def( }, _enterBufferingSentinel: function() { - var shouldSentinelFire = !this._hasSentinelTimeChangedWithinTolerance && !this._nearEndOfMedia ; + var sentinelShouldFire = !this._hasSentinelTimeChangedWithinTolerance && !this._nearEndOfMedia ; if (this.getCurrentTime() === 0) { - shouldSentinelFire = this._trustZeroes && shouldSentinelFire; + sentinelShouldFire = this._trustZeroes && sentinelShouldFire; } if (this._enterBufferingSentinelAttemptCount === undefined) { this._enterBufferingSentinelAttemptCount = 0; } - if(shouldSentinelFire) { + if(sentinelShouldFire) { this._enterBufferingSentinelAttemptCount++; } - if (this._enterBufferingSentinelAttemptCount == 1) { - shouldSentinelFire = false; + if (this._enterBufferingSentinelAttemptCount === 1) { + sentinelShouldFire = false; } - if(shouldSentinelFire) { + if(sentinelShouldFire) { this._emitEvent(MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); this._toBuffering(); /* Resetting the sentinel attempt count to zero means that the sentinel will only fire once @@ -612,6 +612,7 @@ require.def( this._enterBufferingSentinelAttemptCount = 0; return true; } + return false; }, From 93defb2011f1320f9da342611b3013227b83b4ab Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 11:09:47 +0100 Subject: [PATCH 13/14] Renamed function name to be more readable. Removed unnecessary setting of current time --- .../tests/devices/mediaplayer/html5commontests.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index caf83eea..37c47c93 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1266,7 +1266,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye }); }; - var ensureEnterBufferingSentinelIsNotCalled = function(self, MediaPlayer) { + var ensureEnterBufferingSentinelIsNotCalledWhenZeroesCannotBeTrusted = function(self, MediaPlayer) { var i; for (i = 0; i<3; i++) { advancePlayTime(self); @@ -1281,7 +1281,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye assertState(self, MediaPlayer.STATE.PLAYING); }; - var ensureEnterBufferingSentinelIsCalled = function(self, MediaPlayer) { + var ensureEnterBufferingSentinelIsCalledWhenZeroesCanBeTrusted = function(self, MediaPlayer) { for (var i=0; i<2; i++) { stubCreateElementResults.video.currentTime = 0; fireSentinels(self); @@ -1296,7 +1296,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlaying(self, MediaPlayer, 0); clearEvents(self); - ensureEnterBufferingSentinelIsNotCalled(self, MediaPlayer); + ensureEnterBufferingSentinelIsNotCalledWhenZeroesCannotBeTrusted(self, MediaPlayer); }); }; @@ -1306,7 +1306,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlayingWithBeginPlayback(self, MediaPlayer, 20); clearEvents(self); - ensureEnterBufferingSentinelIsNotCalled(self, MediaPlayer); + ensureEnterBufferingSentinelIsNotCalledWhenZeroesCannotBeTrusted(self, MediaPlayer); }); }; @@ -1316,7 +1316,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlaying(self, MediaPlayer, 0); clearEvents(self); - ensureEnterBufferingSentinelIsCalled(self, MediaPlayer); + ensureEnterBufferingSentinelIsCalledWhenZeroesCanBeTrusted(self, MediaPlayer); }); }; @@ -1326,7 +1326,7 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye runMediaPlayerTest(this, queue, function (MediaPlayer) { getToPlayingWithBeginPlayback(self, MediaPlayer, 0); clearEvents(self); - ensureEnterBufferingSentinelIsCalled(self, MediaPlayer); + ensureEnterBufferingSentinelIsCalledWhenZeroesCanBeTrusted(self, MediaPlayer); }); }; @@ -1340,8 +1340,6 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye self._mediaPlayer.playFrom(0); deviceMockingHooks.finishBuffering(self._mediaPlayer); fireSentinels(self); - - stubCreateElementResults.video.currentTime = 0; fireSentinels(self); assertEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); From 6466267ea246be86c6323e08800c9e563ad68ed4 Mon Sep 17 00:00:00 2001 From: Lewis Goodwin Date: Mon, 15 Jun 2015 11:51:11 +0100 Subject: [PATCH 14/14] Added test to ensure enter buffering sentinel does not fire with time increases by less than tolerance twice. --- .../devices/mediaplayer/html5commontests.js | 59 ++++++++++++------- static/script/devices/mediaplayer/html5.js | 2 + 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/static/script-tests/tests/devices/mediaplayer/html5commontests.js b/static/script-tests/tests/devices/mediaplayer/html5commontests.js index 37c47c93..c9616eeb 100644 --- a/static/script-tests/tests/devices/mediaplayer/html5commontests.js +++ b/static/script-tests/tests/devices/mediaplayer/html5commontests.js @@ -1290,6 +1290,27 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye assertState(self, MediaPlayer.STATE.BUFFERING); }; + var testForThreeIntervalsOfNormalPlaybackTwoIntervalsOfZeroesAndOneIntervalOfTimeIncreaseBelowSentinelTolerance = function(self, MediaPlayer) { + var i; + + for (i = 0; i<3; i++) { + advancePlayTime(self); + fireSentinels(self); + } + + for (i=0; i<2; i++) { + stubCreateElementResults.video.currentTime = 0; + fireSentinels(self); + } + + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + + stubCreateElementResults.video.currentTime = 0.01; + fireSentinels(self); + + assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + }; + mixins.testEnterBufferingSentinelDoesNothingWhenDeviceTimeIsReportedAsZeroDuringPlayback = function(queue) { expectAsserts(2); var self = this; @@ -1348,36 +1369,30 @@ window.commonTests.mediaPlayer.html5.mixinTests = function (testCase, mediaPlaye mixins.testEnterBufferingSentinelOnlyFiresOnSecondAttemptWhenDeviceReportsTimeAsNotChangingWithinTolerance = function(queue) { expectAsserts(3); - var self = this; runMediaPlayerTest(this, queue, function (MediaPlayer) { - getToPlaying(self, MediaPlayer, 0); - clearEvents(self); - - var i; - for (i = 0; i<3; i++) { - advancePlayTime(self); - fireSentinels(self); - } + getToPlaying(this, MediaPlayer, 0); + clearEvents(this); - for (i=0; i<2; i++) { - stubCreateElementResults.video.currentTime = 0; - fireSentinels(self); - } - - assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + testForThreeIntervalsOfNormalPlaybackTwoIntervalsOfZeroesAndOneIntervalOfTimeIncreaseBelowSentinelTolerance(this, MediaPlayer); stubCreateElementResults.video.currentTime = 0.01; - fireSentinels(self); - - assertNoEvent(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING); + fireSentinels(this); stubCreateElementResults.video.currentTime = 0.01; - fireSentinels(self); + fireSentinels(this); - stubCreateElementResults.video.currentTime = 0.01; - fireSentinels(self); + assertEventTypeHasBeenFiredASpecificNumberOfTimes(this, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING, 1); + }); + }; + + mixins.testEnterBufferingSentinelDoesNotFireOnTwoNonConsecutiveOccurrencesOfDeviceReportingTimeAsNotChangingWithinTolerance = function(queue) { + expectAsserts(4); + runMediaPlayerTest(this, queue, function (MediaPlayer) { + getToPlaying(this, MediaPlayer, 0); + clearEvents(this); - assertEventTypeHasBeenFiredASpecificNumberOfTimes(self, MediaPlayer.EVENT.SENTINEL_ENTER_BUFFERING, 1); + testForThreeIntervalsOfNormalPlaybackTwoIntervalsOfZeroesAndOneIntervalOfTimeIncreaseBelowSentinelTolerance(this, MediaPlayer); + testForThreeIntervalsOfNormalPlaybackTwoIntervalsOfZeroesAndOneIntervalOfTimeIncreaseBelowSentinelTolerance(this, MediaPlayer); }); }; diff --git a/static/script/devices/mediaplayer/html5.js b/static/script/devices/mediaplayer/html5.js index 5e025003..8a610ac5 100644 --- a/static/script/devices/mediaplayer/html5.js +++ b/static/script/devices/mediaplayer/html5.js @@ -594,6 +594,8 @@ require.def( if(sentinelShouldFire) { this._enterBufferingSentinelAttemptCount++; + } else { + this._enterBufferingSentinelAttemptCount = 0; } if (this._enterBufferingSentinelAttemptCount === 1) {