-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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: try again on volume feature detection on iOS #7514
Conversation
On latest iOS, we are seeing times when the volume feature detection is showing that we are able to change the volume, though, that is not the case. Instead, on iOS, when we detect that we can control the volume, we set a short timer to retest and reset the the featuresVolumeControl property. Fixes #7040
Codecov Report
@@ Coverage Diff @@
## main #7514 +/- ##
==========================================
- Coverage 79.84% 79.83% -0.02%
==========================================
Files 116 116
Lines 7309 7313 +4
Branches 1764 1765 +1
==========================================
+ Hits 5836 5838 +2
- Misses 1473 1475 +2
Continue to review full report at Codecov.
|
src/js/tech/html5.js
Outdated
// on latest iOS, there are cases where we read the volume as changed. | ||
// In those cases, we should add a timeout and check again later. | ||
// Since features doesn't currently work asynchronously, | ||
// we then have to manually set the new value. |
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.
I wanted to make sure I understand fully what's happening, so I tried updating the comment a bit with my understanding. Let me know if there's anything off here, or if it's better off the way it was.
// on latest iOS, there are cases where we read the volume as changed. | |
// In those cases, we should add a timeout and check again later. | |
// Since features doesn't currently work asynchronously, | |
// we then have to manually set the new value. | |
// With the introduction of iOS 15, there are cases where the volume is read as | |
// changed but it reverts back to its original state at the start of the next tick. To | |
// determine whether volume can be controlled on iOS, a timeout is set and the | |
// volume is checked asynchronously. | |
// Since `features` doesn't currently work asynchronously, the value is manually set. |
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.
Sounds good to me.
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.
Updated it manually to adjust positioning
This is a follow-up to #7514. But turns out, that we still had a timing issue around when we were doing the check and when the volume control was created. Instead, we should make `featuresVolumeControl` not be a lazy property, so, that we do that check as early as possible. Also, we should default this property to `false` in this case, so, that we assume we can't until we confirm we can. Additionally, added a null check for Html5, to be extra defensive since the timeout isn't to a player.
This is a follow-up to #7514. But turns out, that we still had a timing issue around when we were doing the check and when the volume control was created. Instead, we should make `featuresVolumeControl` not be a lazy property, so, that we do that check as early as possible. Also, we should default this property to `false` in this case, so, that we assume we can't until we confirm we can. Additionally, added a null check for Html5, to be extra defensive since the timeout isn't tied to a player.
On latest iOS, we are seeing times when the volume feature detection is showing that we are able to change the volume, though, that is not the case. Instead, on iOS, when we detect that we can control the volume, we set a short timer to retest and reset the featuresVolumeControl property. Fixes videojs#7040
This is a follow-up to videojs#7514. But turns out, that we still had a timing issue around when we were doing the check and when the volume control was created. Instead, we should make `featuresVolumeControl` not be a lazy property, so, that we do that check as early as possible. Also, we should default this property to `false` in this case, so, that we assume we can't until we confirm we can. Additionally, added a null check for Html5, to be extra defensive since the timeout isn't tied to a player.
On latest iOS, we are seeing times when the volume feature detection is
showing that we are able to change the volume, though, that is not the
case. Instead, on iOS, when we detect that we can control the volume, we
set a short timer to retest and reset the featuresVolumeControl property.
Fixes #7040