fix cors problem for fart
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user