fix(assets): try to fix audio delay
This commit is contained in:
@@ -41,7 +41,12 @@ const createAudio = (path: string) => {
|
||||
const node = audioContext.createBufferSource();
|
||||
node.buffer = buffer;
|
||||
node.connect(gain).connect(audioContext.destination);
|
||||
|
||||
if (audioContext.state === "suspended") {
|
||||
audioContext.resume().then(() => node.start());
|
||||
} else {
|
||||
node.start();
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user