Initiate the ppn engine inside web workers using porcupine-web-**-factory packages
See original GitHub issueExpected behaviour
The ‘Porcupine’ WASM module created via one of the web factories (e.g.: porcupine-web-en-factory) should work inside and outside of web workers.
Actual behaviour
Outside of Javascript web-workers (UI main thread) the Porcupine.create
method works, inside of web workers it hangs indefinitely at pv_porcupine_init async (_context12, step 76).
Steps to reproduce the behaviour
- Get the ‘@picovoice/porcupine-web-en-factory’ lib
- set up your webpage
- call
const handle = await Porcupine.create(accessKey, [{builtin: "Bumblebee", sensitivity: 0.7}]);
in UI main thread - call same function inside a web-worker
I’m assuming this is related to the validation of the access key, because data is stored in localStorage which cannot be accessed from web worker thread.
A related issue is that each time the localStorage is cleared a new machine ID will be generated and thus the browser will be regarded as new device. Since many systems will regularly clear the cache you will generate new ID constantly and run into the free tier limit immediately.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
https://github.com/Picovoice/porcupine/pull/612 solves this issue. Get the latest package: 2.0.3.
Awesome, its working 🥳 Ty!