Description:
There seems to be a bug in Chrome (maybe in other browsers too) for which the stream of a canvas does not get refreshed on every image draw when it is hidden. But for that to happen, there needs to be these 4 conditions all at once.
- We must feed a video element from a canvas stream (instead of showing the canvas).
- The canvas from which we get the stream must be invisible.
- We must draw on the canvas from an offscreen canvas that we get from the transferControlToOffscreen() call.
- The draw on the offscreen canvas must be done in a web worker.

Additionnal information:
Putting the worker code in a requestAnimationFrame() callback will fix the problem, except that it will work only when the browser tab is focused. This is a side effect I absolutely need to avoid.
Solution: Doing a requestAnimationFrame() call without using the callback parameter and processing the image right after the call also fixes the problem and does not stop when a different browser tab is focused.

Instructions:
- Press "Start" to start drawing the camera feed in the canvas within the web worker. The output should lag.
- Press "Add canvas to page" to show the canvas that is being written on in the web worker. The output should be fluid.
- Press "Remove canvas from page" to hide the canvas and reproduce the bug.
- Check "requestAnimationFrame" to enable the workaround that "fixes" the bug, but adds a side effect which prevents the draws from happening when a different browser tab is focused.
- If you stop the worker and want to test again, refresh the page first.

Images processed by worker:

Webcam feed Canvas Output from canvas stream