-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Changes from 1 commit
8ea8e3c
dcbd7b9
9a78ffc
10761f0
bea6615
288fc4a
684c4ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -229,11 +229,17 @@ class Html5 extends Tech { | |||||
const buffered = this.buffered(); | ||||||
|
||||||
if (buffered.length > 0) { | ||||||
const end = buffered.end(buffered.length - 1); | ||||||
let extraBuffer = false; | ||||||
|
||||||
// if tech is not paused, browser has internet connection & end + safe delta >= current time | ||||||
if ((!this.paused() && window.navigator.onLine) && | ||||||
(end + SAFE_TIME_DELTA >= 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) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
extraBuffer = true; | ||||||
} | ||||||
} | ||||||
|
||||||
// if tech is not paused, browser has internet connection & player has extraBuffer inside the timeRange | ||||||
if ((!this.paused() && window.navigator.onLine) && extraBuffer) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the extra parens are necessary as the expression will just evaluate each item in turn.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, should we check extraBuffer first? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sense and we can decide quicker the state of the playback. |
||||||
this.pause(); | ||||||
} | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should do
to eliminate the scope here.