Skip to content

Conversation

@junyuecao
Copy link

@junyuecao junyuecao commented Jan 11, 2024

This PR tries to support webgl contexts in worker as this issue described: #149

I added a headless spector(no ui) as the BaseSpector and a Spector is the same as the original one.
For worker capturing, the developer should create a BaseSpector in the worker and use a RemoteSpector to communication with the worker in the main thread.

Usage is like:

  1. import the BaseSpector in the worker and wait for canvas, once the rendering worker created, set the window.__SPECTOR_worker = worker in main thread. And send the element id to the worker OffscreenCanvas.__SPECTOR_id=[canvasElement.id] (we use the id to identify target context)
  2. import the RemoteSpector in main thread
  3. Use RemoteSpector.captureCanvas(canvas) as normal

The demo shows how to capture in a worker with a url param worker=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant