Suddenly "this.audiocontext.createScriptProcessor is not a function" error in p5js-sound

718 views Asked by At

I have a website, that should play mp3 files after clicking on a logo. When a sound is played, the p5.js library (p5js-sound) draws some graphic on the background. Suddenly it has stopped working. In the Chrome console log, the problem is with this line. Without any reason after two years of working properly, it started to give this error

Uncaught TypeError: this.audiocontext.createScriptProcessor is not a function.

I found out that it works in Firefox and on some computers with older versions of Chrome. How to solve this problem?

2

There are 2 answers

0
Cobain Ambrose On

It is unlikely that this is a problem with your code or anything you have done to the p5.sound library.
On the contrary, it may be an out-of-date version of the library and the processing foundation may not have updated it yet.
They are a non-profit organisation so cut them some slack but I suggest using an alternative library for now
You could use native functions like an onclick="" that controls whether a hidden <audio></audio> tag is playing - Good luck coding!

1
Miles D On

Newest versions of Chrome will not "autoplay" audio. Some kind of user interaction is required, ie. click on something to "start" the audio context. When I get it to work I will post code.