Skip to content

Commit

Permalink
Merge pull request #5920 from gnattu/fix-safari-volume-10.9
Browse files Browse the repository at this point in the history
  • Loading branch information
thornbill authored Aug 17, 2024
2 parents 8bc9544 + 2305240 commit 90236c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/apphost.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const supportedFeatures = function () {
features.push('fullscreenchange');
}

if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) {
if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile || browser.ipad) {
features.push('physicalvolumecontrol');
}

Expand Down
5 changes: 5 additions & 0 deletions src/plugins/htmlAudioPlayer/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ class HtmlAudioPlayer {

if (normalizationGain) {
self.gainNode.gain.value = Math.pow(10, normalizationGain / 20);
self.normalizationGain = self.gainNode.gain.value;
} else {
self.gainNode.gain.value = 1;
self.normalizationGain = 1;
}
console.debug('gain: ' + self.gainNode.gain.value);
}).catch((err) => {
Expand Down Expand Up @@ -311,6 +313,9 @@ class HtmlAudioPlayer {
function onVolumeChange() {
if (!self._isFadingOut) {
htmlMediaHelper.saveVolume(this.volume);
if (browser.safari) {
self.gainNode.gain.value = this.volume * self.normalizationGain;
}
Events.trigger(self, 'volumechange');
}
}
Expand Down

0 comments on commit 90236c2

Please sign in to comment.