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: try again on volume feature detection on iOS #7514

Merged
merged 3 commits into from
Nov 17, 2021
Merged

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Nov 12, 2021

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

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
Copy link

codecov bot commented Nov 12, 2021

Codecov Report

Merging #7514 (c9c8379) into main (6c67c30) will decrease coverage by 0.01%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
src/js/tech/html5.js 63.49% <60.00%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c67c30...c9c8379. Read the comment docs.

src/js/tech/html5.js Outdated Show resolved Hide resolved
@gkatsev gkatsev added the needs: LGTM Needs one or more additional approvals label Nov 16, 2021
Comment on lines 1038 to 1041
// 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.
Copy link
Contributor

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.

Suggested change
// 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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good to me.

Copy link
Member Author

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

@gkatsev gkatsev merged commit 1d96d1c into main Nov 17, 2021
@gkatsev gkatsev deleted the ios-volume-check branch November 17, 2021 17:27
gkatsev added a commit that referenced this pull request Dec 1, 2021
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.
gkatsev added a commit that referenced this pull request Dec 1, 2021
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.
@misteroneill misteroneill removed the needs: LGTM Needs one or more additional approvals label May 23, 2023
edirub pushed a commit to edirub/video.js that referenced this pull request Jun 8, 2023
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
edirub pushed a commit to edirub/video.js that referenced this pull request Jun 8, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't set volume when using iPhone without full screen
3 participants