I am working on the existing codoCircle. Put the volume down.
It works out as expected.
Now i want to use the same code here in codepen and i get this error
TypeError: Failed to set the 'buffer' property on 'AudioBufferSourceNode': The provided value is not of type 'AudioBuffer
I did a bit of research and i have found the first answer useful.
The answer says
At the time i assign in the playSound
player.buffer = buffer
, buffer is still undefined because the load callback hasn't fired.
This makes sense to me, so then i have tried to do a
setTimeout
like:
setTimeout(playSound, 9000);
It did not work out.
Do you know any workaround for this? And why in CodeCircle works and not in Codepen?