Only create context if gain mode active (#2173)
This commit is contained in:
@@ -69,7 +69,8 @@ const Player = () => {
|
|||||||
context === null &&
|
context === null &&
|
||||||
audioInstance &&
|
audioInstance &&
|
||||||
config.enableReplayGain &&
|
config.enableReplayGain &&
|
||||||
'AudioContext' in window
|
'AudioContext' in window &&
|
||||||
|
(gainInfo.gainMode === 'album' || gainInfo.gainMode === 'track')
|
||||||
) {
|
) {
|
||||||
const ctx = new AudioContext()
|
const ctx = new AudioContext()
|
||||||
// we need this to support radios in firefox
|
// we need this to support radios in firefox
|
||||||
@@ -83,7 +84,7 @@ const Player = () => {
|
|||||||
setContext(ctx)
|
setContext(ctx)
|
||||||
setGainNode(gain)
|
setGainNode(gain)
|
||||||
}
|
}
|
||||||
}, [audioInstance, context])
|
}, [audioInstance, context, gainInfo.gainMode])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (gainNode) {
|
if (gainNode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user