From b129cae0d8b1d8e672626bd74917d0ec1809cc1c Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Tue, 14 Feb 2023 00:57:23 +0000 Subject: [PATCH] Only create context if gain mode active (#2173) --- ui/src/audioplayer/Player.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/src/audioplayer/Player.js b/ui/src/audioplayer/Player.js index 245b099b..73f17f26 100644 --- a/ui/src/audioplayer/Player.js +++ b/ui/src/audioplayer/Player.js @@ -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) {