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 GitHub
parent 2400e4f60d
commit b129cae0d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

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) {