Reputation: 469
I have a Chrome packaged application that receives UDP packets containing audio data using Chrome.sockets.udp and plays them using the Web Audio API. As you can imagine, this ends up being a pretty heavy load on the CPU, and I start dropping packets if I try to open up another Chrome window, which leads me to believe that once I start adding interactive UI elements I'll start running into problems. I wanted to pack up all this stuff nicely in a Web Worker to avoid that, but when I try to do so and declare var socket = chrome.sockets.udp;
in my Web Worker, I end up getting an Uncaught ReferenceError: chrome is not defined
when I try to use it. Is it not possible to use the Chrome sockets API in a Web Worker? It seems like a Web Worker would be a perfect use case for such a thing.
Upvotes: 1
Views: 474
Reputation: 2785
You can use transferable objects to pass Blob/Buffer to the web worker process from the main application.
Upvotes: 1