From 760982044a36d817a04617db240fd8be537dac5a Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Sun, 15 Sep 2024 18:41:14 +0200 Subject: [PATCH] fix: Don't show playback error when quickly switching out audio nodes --- src/Javascript/UI/audio.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Javascript/UI/audio.ts b/src/Javascript/UI/audio.ts index 1c502d74..cb5cd2bf 100644 --- a/src/Javascript/UI/audio.ts +++ b/src/Javascript/UI/audio.ts @@ -114,10 +114,12 @@ function play({ trackId, volume }: { trackId: string, volume: number }) { audio.muted = false if (audio.readyState === 0) audio.load() + if (!audio.isConnected) return const promise = audio.play() || Promise.resolve() promise.catch((e) => { + if (!audio.isConnected) return /* The node was removed from the DOM, we can ignore this error */ const err = "Couldn't play audio automatically. Please resume playback manually." console.error(err, e) if (app) app.ports.fromAlien.send({ tag: "", data: null, error: err }) -- 2.51.2