Skip to content

Commit

Permalink
Fix safari volume being reset when track changed (jellyfin#5923)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnattu authored Aug 18, 2024
1 parent 90236c2 commit 6a8f21e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/plugins/htmlAudioPlayer/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,17 @@ class HtmlAudioPlayer {
}

if (normalizationGain) {
self.gainNode.gain.value = Math.pow(10, normalizationGain / 20);
self.normalizationGain = self.gainNode.gain.value;
self.normalizationGain = Math.pow(10, normalizationGain / 20);
self.gainNode.gain.value = self.normalizationGain;
} else {
self.gainNode.gain.value = 1;
self.normalizationGain = 1;
}
console.debug('gain: ' + self.gainNode.gain.value);
if (browser.safari) {
// Gain value is absolute in Safari. Add volume from the slider
self.gainNode.gain.value *= elem.volume;
}
console.debug('gain: ' + self.normalizationGain);
}).catch((err) => {
console.error('Failed to add/change gainNode', err);
});
Expand Down

0 comments on commit 6a8f21e

Please sign in to comment.