google / google/model-viewer

Error loadfailure switching glTF models on low-end devices

Open
#4,981 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8.2k
Forks
947
PR merge metrics
No merged PRs in 30d

Description

Hello. I've been working with model-viewer for some time now, and I like it a lot, so, thank you! : )

Recently, a problem has arisen in a client project: on low-end devices, a `loadfailure` error occurs when changing the source programmatically. This does not always happen in exactly the same way, nor with all 3D models. But if the model is more complex (lots of triangles) or the device's resources are low, it is almost certain. On desktop it works perfectly, fast, without problems, so I suppose it must be a resource issue.

Using Chrome DevTools to monitor the console of a webpage opened in Chrome on Android, I can see this message:

`error: "Aborted(). Build with -sASSERTIONS for more info."`

Full info:

![Image](https://github.com/user-attachments/assets/36088dbc-1b09-4d5e-8f06-2b4911e9690a)

This error points to this external resource file: **CachingGLTFLoader.js**, line 152, inside the function `preload`, with this comment:

_Preloads a glTF, populating the cache. Returns a promise that resolves when the cache is populated._

My main test device are:

- Android 10 (Moto G7 Play, 2 gb ram, old, I know..) - Chrome, Brave

And other similar ones, borrowed, to rule out cache persistence problems.

I'm changing the model with this line:

`modelViewer.setAttribute("src", url);`

Model-viewer version 4.0.0.

I have tried several approaches, without much success, like changing `modelCacheSize `to `1` or `2`, `powerPreference` to `low-power`, or destroying and regenerating the model-viewer using the new source. The error persists.

Any ideas about this?, or should I assume it may fail on older phones?

Thank you!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.