Skip to content

Commit

Permalink
Fix Safari volume control
Browse files Browse the repository at this point in the history
  • Loading branch information
gnattu committed Aug 17, 2024
1 parent 8bc9544 commit 0658ca9
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 = normalizationGain;
} 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 0658ca9

Please sign in to comment.