score:0

Changing:

this.context.audioWorklet.addModule('worklet/processor.js') 

with

this.context.audioWorklet.addModule('../worklet/processor.js') 

worked for me.

score:2

This seems to be a bug in the Chromium module loader, it parses the worklet/processor.js file by removing whitespace, which in turn causes it to have JavaScript syntax errors everywhere, which then finally causes this generic non-explanatory error message to show up.

The solution is to serve your worklet-processors (e.g. worklet/processor.js in your case) with:

Content-Type: application/javascript

or

Content-Type: text/javascript

score:2

This worked for me: serve your worklet files from public folder instead of src. The addModule(url) function points there by default, so addModule('worklets/foo.js') references file public\worklets\foo.js

Source: https://hackernoon.com/implementing-audioworklets-with-react-8a80a470474

score:3

For anyone else getting this mysterious error, swallow your pride and check the following:

  • The processor doesn't have any errors.
  • The processor is calling external modules with proper path to the external file(s).
  • The external modules don't have any errors.

The promise will abort when external modules that are loaded via "import" have errors, or the paths to the modules can't be resolved (e.g. the path's to the modules are wrong and don't point to existing files).

score:10

My code is straight JavaScript, not React, but I got the same error because the path provided to addModule was incorrect. In my case, both the script that calls addModule and the script provided as the argument to addModule reside in the same directory ("js"). In spite of that, I still had to include this directory in the path to eliminate the error:

...addModule('js/StreamTransmitter.js')...

I hope this helps. Good luck!


Related Query

More Query from same tag