Fixes a race condition in canvas.captureStream() and resolveFilter().
We were resolving the filter too early and discarding the <canvas> element too aggressively whenever the track dimensions changed (key prop). Upon discarding, the already captured stream was muted and hence, streaming nothing.
Now, these races are fixed by properly synchronizing the order of operations:
Obtain the original video stream
Render the stream inside a video element
Take the correct stream dimensions once playback starts
Render the
Resolve the filter promise and let the SDK publish the filtered video stream
Overview
Fixes a race condition in
canvas.captureStream()
andresolveFilter()
.We were resolving the filter too early and discarding the
<canvas>
element too aggressively whenever the track dimensions changed (key
prop). Upon discarding, the already captured stream was muted and hence, streaming nothing.Now, these races are fixed by properly synchronizing the order of operations: