Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: validation for stalled and suspended event in iOS when headphones disconnect #6199

Merged
merged 7 commits into from
Oct 4, 2019
Prev Previous commit
Next Next commit
current Time comparition with end and start buffer time range using …
…, extraBuffer is compared first
  • Loading branch information
marcodeltorob committed Sep 9, 2019
commit 288fc4a3530f6a759100a6ceecf3dba5a8d0069d
6 changes: 4 additions & 2 deletions src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,19 @@ class Html5 extends Tech {

if (buffered.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do

if (!bufferred.length) {
  return;
}

to eliminate the scope here.

let extraBuffer = false;
const currentTime = this.currentTime();

// Establish if we have an extra buffer in the current time range playing.
for (let i = 0; i < buffered.length; i++) {
if (buffered.start(i) <= this.currentTime() < buffered.end(i) + SAFE_TIME_DELTA) {
if (buffered.start(i) <= currentTime &&
currentTime < buffered.end(i) + SAFE_TIME_DELTA) {
extraBuffer = true;
break;
}
}

// if tech is not paused, browser has internet connection & player has extraBuffer inside the timeRange
if ((!this.paused() && window.navigator.onLine) && extraBuffer) {
if (extraBuffer && !this.paused() && window.navigator.onLine) {
this.pause();
}
}
Expand Down