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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,21 @@ Html5.canControlVolume = function() {
const volume = Html5.TEST_VID.volume;

Html5.TEST_VID.volume = (volume / 2) + 0.1;
return volume !== Html5.TEST_VID.volume;

const canControl = volume !== Html5.TEST_VID.volume;

// With the introduction of iOS 15, there are cases where the volume is read as
// changed but 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.
if (canControl && browser.IS_IOS) {
window.setTimeout(() => {
Html5.prototype.featuresVolumeControl = volume !== Html5.TEST_VID.volume;
});
}

return canControl;
} catch (e) {
return false;
}
Expand Down