Started working on a project last night, woke up to work on it today, and I’m randomly getting the error: “The buffer passed to decodeAudioData contains an unknown content type.”. Nothing has changed since I last worked on this. I didn’t even commit. No, nothing has changed to the audio files. I have exported them multiple times, in Audacity, FL, and used both .wav and .mp3. Same error. Seems to be completly random.
const playSound = (url, volume) => {
fetch(url)
.then(response => response.arrayBuffer())
.then(arrayBuffer => audioContext.current.decodeAudioData(arrayBuffer))
.then(audioBuffer => {
const source = audioContext.current.createBufferSource();
const gainNode = audioContext.current.createGain();
gainNode.gain.value = volume;
source.buffer = audioBuffer;
source.connect(gainNode).connect(audioContext.current.destination);
source.start(0);
});
My play sound function. All my audio clips are in one folder, /public/sounds/
.
React decodeAudioData
randomly stopped working.
5