safariweb-audio-apiaudiocontextwebkitaudiocontext

AudioContext not working on Safari, even though state is running


I am trying to build a simple equalizer and i am trying Web AudioContext for the same. I have tried instantiating the context after a user click/gesture. and i see the state is running.

I have a slider that basically changes the gains to get the desired effect, the code works fine on chrome and firefox but on safari it does not and i do not see any errors/warning being thrown as well. I have tried the google chrome web audio docs as well but failed. Please help me finding what i am doing wrong.

Here is the link to deployed app: Demo

Here is the Code for the same: Code

Thanks.

  1. i tried checking if the state is suspended.
  2. tried resuming when user does any action.
  3. made sure the AudioContext state is running before changing gains.
  4. followed google chrome docs docs

Expected Behavior:

  1. The changes to gain should be observed when using safari and the audio effects should apply.

Solution

  • This seems to be a long standing bug in Safari.

    https://bugs.webkit.org/show_bug.cgi?id=180696

    Your demo works when playing a local file instead of a remote stream.

    It's probably possible to write some code which loads the stream in chunks using fetch() and then parses and decodes it manually to finally play it with the Web Audio API. But it's certainly not an easy thing to do.