This commit is contained in:
+4
-3
@@ -121,7 +121,7 @@ const howlCache = new Map<string, Howl>();
|
|||||||
export function playSoundUrl(url: string) {
|
export function playSoundUrl(url: string) {
|
||||||
let h = howlCache.get(url);
|
let h = howlCache.get(url);
|
||||||
if (!h) {
|
if (!h) {
|
||||||
h = new Howl({
|
const newH = new Howl({
|
||||||
src: [url],
|
src: [url],
|
||||||
format: url.endsWith(".mp3") ? ["mp3"] : url.endsWith(".ogg") ? ["ogg"] : ["mp3", "ogg"],
|
format: url.endsWith(".mp3") ? ["mp3"] : url.endsWith(".ogg") ? ["ogg"] : ["mp3", "ogg"],
|
||||||
volume: 0.4,
|
volume: 0.4,
|
||||||
@@ -130,10 +130,11 @@ export function playSoundUrl(url: string) {
|
|||||||
},
|
},
|
||||||
onplayerror: (_id: number, err: unknown) => {
|
onplayerror: (_id: number, err: unknown) => {
|
||||||
console.error("[BaraBingo] Howl play error:", url, err);
|
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();
|
h.play();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user