chrisguttandin / standardized-audio-context

A cross-browser wrapper for the Web Audio API which aims to closely follow the standard.
MIT License
680 stars 33 forks source link

[Chrome, AudioWorkletNode] Instantiating AudioContext generates a warning in the browser #982

Closed korbav closed 3 years ago

korbav commented 3 years ago

I noticed that the AudioWorkletNode concern seems to have been tackled a long time ago but I wanted to raise this issue that occurs systematically. This is not that bad since it's just a warning though, but I'd like to know if I missed anything.

As soon as I instantiate a new AudioContext, the following warning appears in the latest Chrome in Windows :

The ScriptProcessorNode is deprecated. Use AudioWorkletNode instead. (https://bit.ly/audio-worklet)

Tracing it back leads to the following line (please look at the picture below to see the full calling stack) :

https://github.com/chrisguttandin/standardized-audio-context/blob/9fb8631d5bc2fdae7a811d232371fddb7e544c89/src/helpers/test-audio-node-disconnect-method-support.ts#L5

image

If my understanding is good (which is really unsure), the AudioWorklet should be used behind the scene except for Safari without having to do any extra thing, but I'm probably missing something obvious lacking knowledge on Audio API, if so, I'm sorry for the issue, please feel free to close it.

chrisguttandin commented 3 years ago

Hi @korbav, thanks for raising this issue. I honestly saw this message in the console before, too. I chose to ignore it. :-) Even though the ScriptProcessorNode is deprecated I think it will never go away as it would break a couple of websites.

But I understand that this message is confusing and luckily there is a way to get rid of it which even makes standardized-audio-context a tiny bit faster.

The function which is still using the ScriptProcessorNode is a check that probes if a certain workaround needs to be applied or not. Since the bug which makes this workaround necessary only occurs in browsers without an AudioWorklet implementation I made a little change to skip the test entirely in those browsers.

korbav commented 3 years ago

Hi @korbav, thanks for raising this issue. I honestly saw this message in the console before, too. I chose to ignore it. :-) Even though the ScriptProcessorNode is deprecated I think it will never go away as it would break a couple of websites.

But I understand that this message is confusing and luckily there is a way to get rid of it which even makes standardized-audio-context a tiny bit faster.

The function which is still using the ScriptProcessorNode is a check that probes if a certain workaround needs to be applied or not. Since the bug which makes this workaround necessary only occurs in browsers without an AudioWorklet implementation I made a little change to skip the test entirely in those browsers.

Hi @chrisguttandin , great fix, I got it now thank you, it was just an extra check so! appreciated 👍