AudioContext failed to resume in iOS Safari 17.4 beta: InvalidStateError: Failed to start the audio device

224 Views Asked by At

The problem is new in the newly published iOS Safari 17.4 beta.

The code below will go into the catch block with error message:

InvalidStateError: Failed to start the audio device

Tested on an iPhone 11 with iOS 17.4 beta.

const context = new AudioContext();

window.handleClick = () => {
  console.log('state', context.state);
  context.resume().then(() => {
      document.write('state:' + context.state);
      console.log('state', context.state);
  }, (e) => {
      document.write('state:' + context.state + ' ' + e);
      console.error(e);
  });
};

Live demo click here

0

There are 0 best solutions below