From 4d02613652aaefb073537895794461d61a7d3d34 Mon Sep 17 00:00:00 2001 From: gnattu Date: Sun, 25 Aug 2024 02:47:25 -0400 Subject: [PATCH] Backport pull request #5920 from jellyfin-web/release-10.9.z Fix Safari volume control Original-merge: 90236c25ee1b0bbad5723c15264d3a8d6a3479db Merged-by: thornbill Backported-by: Joshua M. Boniface --- src/components/apphost.js | 2 +- src/plugins/htmlAudioPlayer/plugin.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/apphost.js b/src/components/apphost.js index c99d9c72ec7..b92bb6faa08 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -272,7 +272,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'); } diff --git a/src/plugins/htmlAudioPlayer/plugin.js b/src/plugins/htmlAudioPlayer/plugin.js index 34b573317d4..131b8cdfee7 100644 --- a/src/plugins/htmlAudioPlayer/plugin.js +++ b/src/plugins/htmlAudioPlayer/plugin.js @@ -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) => { @@ -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'); } }