Create screenshot using render target, and report an error on iOS “Can't find variable:OffscreenCanvas”

hi, I use babylon tools api to generate screenshot from Render Scenes To .png Files | Babylon.js Documentation

when I CreateScreenshotUsingRenderTarget, it can always produce screenshots normally

But when I use CreateScreenshotAsync, sometimes it can be generated normally, but there is also a probability of exceptions as follows

I don’t understand why there are these differences, but in order to achieve functionality, I chose to use CreateScreenshotUsingRenderTarget for generation. However, I encountered a problem, which is that it cannot run properly on iOS because it uses offscreencanvas for generation. Older versions of iOS do not support offscreencanvas. Looking at the code where the error occurred, would it be better to include error capture in offscreencanvas initialization?

babylon version is 6.19.1

You’re right, here’s a fix for browsers that don’t support OffscreenCanvas at all:


Thanks you so much ~