iOS auto refresh when engine.resize() is called

Hello,
since iOS 14 has been introduced, there’s been some issues with web application embedding webGL canvas - the issue being the auto refresh of the page caused by a memory issue (it seems).

With IOS 15, the problem is less persistent, meaning that a project i’m working on that couldn’t even load on mobile cause kept refreshing now, with the 15 version, is showing the page as expected.

The only problem is that, whenever i resize the page (when the navigation bars appear/disappear, or when i trigger it voluntarily), the website still auto-refreshes.

I realized that, when removing the engine.resize() code, it doesn’t refresh anymore.

These are the properties of the instanced engine → new Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true }, true)

I tried to create a playground, but the model and code is too light to recreate that problem.
My project is kind of big and has a large use of 3d, so I guess that also this aspect has an impact.

Does anyone else has experienced this issue? Do you know if there’s a way to avoid it?

Thank you in advance :sun_with_face:

In the few projects I did for iOS i did experience the same behavior. This was caused, as you write, due to the amount of resources used in the specific project. In my case it was the size of the textures that filled up the device’s (GPU) RAM.
There is little we can do about iOS’ memory management. You will have to reduce the amount or quality of the resources. Think about other users with older phones - they will not be able to watch it at all.

I haven’t had anything to do with this OS for a long time, so maybe someone else has a better answer, but my suggestion would be - optimize as much as you can, wherever you can.

2 Likes

Hey @RaananW, thank you for your answer!
I’ll try to optimize it the more I can.

I hoped there was a magic workaround since I noticed that the auto reload is triggered when the engine.resize() is called, but most of the time there’s no easy solution.