Skip to content

Commit

Permalink
WEB_NOTES update
Browse files Browse the repository at this point in the history
  • Loading branch information
alnitak committed Jul 15, 2024
1 parent b4e5ca3 commit 9a5dfa3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions WEB_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ Here a sketch to show the step used:
**#1.** This function is called while initializing the player with `FlutterSoLoudWeb.setDartEventCallbacks()`.
It creates a Web Worker in the [WASM Module](https://emscripten.org/docs/api_reference/module.html) using the compiled `web/worker.dart`. After calling this, the WASM Module will have a new variable called `Module.wasmWorker` which will be used in Dart to receive messages.
By doing this it will be easy to use the Worker to send messages from within the CPP code.

**#2.** This function, like #1, uses [EM_ASM](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#interacting-with-code-call-javascript-from-native) to inline JS. This JS code uses the `Module.wasmWorker` created in #1 to send a message.

**#3.** This is the JS used and created in #1. Every messages sent by #2 are managed here and sent to #4.

**#4.** Here when the event message has been received, a new event is added to a Stream. This Stream is listened by the SoLoud API.

**#5.** Here we listen to the event messages coming from the `WorkerController` stream. Currently, only the "voice ended" event is supported. The Stream is listened in `SoLoud._initializeNativeCallbacks()`.

0 comments on commit 9a5dfa3

Please sign in to comment.