fun: tuneage
This commit is contained in:
parent
e87d921714
commit
023e82c521
|
@ -118,6 +118,29 @@ export default function PlaySpecific() {
|
|||
clearInterval(handle);
|
||||
};
|
||||
}, [client, disconnected, url]);
|
||||
useEffect(() => {
|
||||
let source = true;
|
||||
async function play() {
|
||||
const ctx = new AudioContext();
|
||||
const response = await fetch(new URL('/assets/yuff.wav', window.location.origin));
|
||||
const buffer = await ctx.decodeAudioData(await response.arrayBuffer());
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
source = ctx.createBufferSource();
|
||||
source.buffer = buffer;
|
||||
source.connect(ctx.destination);
|
||||
source.loop = true;
|
||||
source.start();
|
||||
}
|
||||
setTimeout(play, 1000);
|
||||
return () => {
|
||||
if (true !== source) {
|
||||
source.stop();
|
||||
}
|
||||
source = false;
|
||||
};
|
||||
}, [])
|
||||
return (
|
||||
<ClientContext.Provider value={client}>
|
||||
<MainEntityContext.Provider value={mainEntityTuple}>
|
||||
|
|
BIN
public/assets/yuff.wav
Normal file
BIN
public/assets/yuff.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user