fix cors problem for fart

This commit is contained in:
2025-07-17 20:15:04 +02:00
parent 702725f106
commit de18e0d467

View File

@@ -98,7 +98,13 @@
// Pre-fetch & decode once (lazy: only on first click)
async function initAudio() {
ctx = new (window.AudioContext || window.webkitAudioContext)()
const res = await fetch(AUDIO_FILE)
const res = await fetch(AUDIO_FILE, {
method: "GET",
mode: "cors", // nur nötig, wenn Domain ≠ Seite
headers: {
"X-API-Key": API_KEY,
},
})
const array = await res.arrayBuffer()
buffer = await ctx.decodeAudioData(array)
}