Only create context if gain mode active (#2173)

This commit is contained in:
Kendall Garner 2023-02-14 00:57:23 +00:00 committed by Joe Stump
parent 82d907d037
commit 89ab1ee4f6
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -69,7 +69,8 @@ const Player = () => {
context === null &&
audioInstance &&
config.enableReplayGain &&
'AudioContext' in window
'AudioContext' in window &&
(gainInfo.gainMode === 'album' || gainInfo.gainMode === 'track')
) {
const ctx = new AudioContext()
// we need this to support radios in firefox
@ -83,7 +84,7 @@ const Player = () => {
setContext(ctx)
setGainNode(gain)
}
}, [audioInstance, context])
}, [audioInstance, context, gainInfo.gainMode])
useEffect(() => {
if (gainNode) {