diff --git a/lib/sounds.ts b/lib/sounds.ts index c449d43..14cde51 100644 --- a/lib/sounds.ts +++ b/lib/sounds.ts @@ -121,7 +121,7 @@ const howlCache = new Map(); export function playSoundUrl(url: string) { let h = howlCache.get(url); if (!h) { - h = new Howl({ + const newH = new Howl({ src: [url], format: url.endsWith(".mp3") ? ["mp3"] : url.endsWith(".ogg") ? ["ogg"] : ["mp3", "ogg"], volume: 0.4, @@ -130,10 +130,11 @@ export function playSoundUrl(url: string) { }, onplayerror: (_id: number, err: unknown) => { console.error("[BaraBingo] Howl play error:", url, err); - h.once("unlock", () => h.play()); + newH.once("unlock", () => newH.play()); }, }); - howlCache.set(url, h); + howlCache.set(url, newH); + h = newH; } h.play(); }