Bubble Foundry


Playing Web Audio on iOS

by Peter.

When using the Web Audio API on iOS, you have run into the problem that you don’t hear anything despite it all to be be wired up correctly and no errors being thrown. There is a small notice in the Safari documentation that sounds must be triggered by explicit user action, but what does that mean?

In short, you should have something like this:

<body onload="createContextAndLoadBuffers();">
  <button id="b" onclick="createSourceAndPlay();">Play</button>
</body>

I tried initializing things at different stages, including everything in response to the click, but only this worked.