-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
#20349 (comment) encountered problems with SharedArrayBuffer. Neither of the tutorials mentions CORS, so this was an inevitable error: https://emscripten.org/docs/api_reference/wasm_audio_worklets.html, https://github.com/emscripten-core/emscripten/blob/main/test/webaudio/audioworklet.c.
Proposed solution: Add docs. At https://emscripten.org/docs/api_reference/wasm_audio_worklets.html, right after "Compile the code with the linker flags -sAUDIO_WORKLET=1 -sWASM_WORKERS=1 to enable targeting AudioWorklets.", this text is added:
"Web browsers prohibit sharing data between threads unless CORS headers are set. If you try to open the html file you just compiled, you will receive the error SharedArrayBuffer is not defined. To fix this, host the html file with a web server that sets CORS headers. For example, you can run python3 \[this python script\] to serve all files in the same directory, then navigate to http://127.0.0.1:8000/your_file_here.html. See MDN for more information."
The python script is this one. The extension should be .py; github doesn't let me upload .py files.