Фикс звуков из ресурсов

This commit is contained in:
RoyceDa
2026-03-20 16:46:23 +02:00
parent 8f0e8e8251
commit 9f8840e077
5 changed files with 23 additions and 12 deletions

View File

@@ -14,7 +14,7 @@ export function useSound() {
audioRef.current.load();
};
const playSound = (sound : string, loop: boolean = false) => {
const playSound = async (sound : string, loop: boolean = false) => {
try {
if(loop){
if (!loopingAudioRef.current) {
@@ -24,7 +24,7 @@ export function useSound() {
loopingAudioRef.current.loop = true;
}
const url = window.mediaApi.getSoundUrl(sound);
const url = await window.mediaApi.getSoundUrl(sound);
const player = loopingAudioRef.current;
player.src = url;
@@ -43,7 +43,7 @@ export function useSound() {
audioRef.current.loop = loop;
}
const url = window.mediaApi.getSoundUrl(sound);
const url = await window.mediaApi.getSoundUrl(sound);
const player = audioRef.current;
stopSound();