fun: tuneage

This commit is contained in:
cha0s 2024-06-28 12:07:53 -05:00
parent e87d921714
commit 023e82c521
2 changed files with 23 additions and 0 deletions

View File

@ -118,6 +118,29 @@ export default function PlaySpecific() {
clearInterval(handle); clearInterval(handle);
}; };
}, [client, disconnected, url]); }, [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 ( return (
<ClientContext.Provider value={client}> <ClientContext.Provider value={client}>
<MainEntityContext.Provider value={mainEntityTuple}> <MainEntityContext.Provider value={mainEntityTuple}>

BIN
public/assets/yuff.wav Normal file

Binary file not shown.