Closed mifi closed 2 years ago
Update: The img bug was due to broken ffmpeg node.js stream code. After fixing that bug, I have not seen this bug again when using images instead of canvas. Because canvas is no longer used by default I'm closing this.
Sometimes
screenshot
will take a screenshot before canvas/image has finished rendering.Observations/testing:
canvas
orimg
(typepng
orraw
), which are sourced from the ffmpeg data: https://github.com/mifi/reactive-video/blob/65a19364f2b3e21fc2c813eb931ffd8140ff2a5d/packages/frontend/src/components/FFmpegVideo.js#L39Image
, oneFFmpegVideo
and some text - only theImage
and text got renderedcanvas.dataURL()
and setting on src on img yields the same sporadic issuesetTimeout(..., 0)
and multiplerequestAnimationFrame
does not help. (or multipleawaitDomRenderSettled
)png
seems to produce more frequently thanraw
(maybe due to higher CPU usage)screenshot
can reproduce it butscreencast
seems to reproduce even more oftenWorkarounds
setTimeout(500)
orpage.waitForNetworkIdle
(which I think also waits for 500ms) will workaround this issue but it's a hack because it's not real synchronisation and may in theory fail some time.Alternatives
Doesn't work
HeadlessExperimental frame control
Not tried
ReactDOM.render(element, container[, callback])
https://reactjs.org/docs/react-dom.html#renderLinks
Possibly related