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
Break in for when we have extra buffer and fix in the conditional
  • Loading branch information
marcodeltorob committed Sep 9, 2019
commit bea66151635908c288240e06d1d3d57f9383753a
3 changes: 2 additions & 1 deletion src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ class Html5 extends Tech {

// 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) <= this.currentTime() < buffered.end(i) + SAFE_TIME_DELTA) {
Copy link
Member

Choose a reason for hiding this comment

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

I just verified and buffered.start(i) <= this.currentTime() < buffered.end(i) doesn't work.
It'll get evaluated as if there are parenthesis around the buffered.start(i) <= this.currentTime() and evaluate it to true (potentially) which will end up being smaller than any buffered.end(i).

> [2, 4, 6, 8, 10].map((f) => 2 <= f < 8)
< [true, true, true, true, true]
> [2, 4, 6, 8, 10].map((f) => 2 <= f && f < 8)
< [true, true, true, false, false]

extraBuffer = true;
break;
}
}

Expand Down