Hello, I’ve ran into an issue when trying to fetch mp3 files into my page and use it with Web Audio API. Here is my code snippet:
// saved the filenames into sounds.js and loaded it
for (let i = 0; i < sounds.length; i++) {
var filename = sounds[i]['path'];
console.log(filename);
let audio;
fetch(filename)
.then((data) => data.arrayBuffer())
.then((arrayBuffer) => audioContext.decodeAudioData(arrayBuffer))
.then((decodeAudio) => {
audio = decodeAudio;
})
}
The code worked for my local server, but on netlify it gave errors as below:
Thanks so much for the response! Realized I made a beginner’s mistake here, I forgot that the build version running on Netlify has a different filename and folder structure as what I had locally.
Hiya @heyou88, welcome to the forums! Thanks for coming back and letting us know what worked for you. This will help other forum users debug in the future. We appreciate your help.