sceneform-android
sceneform-android copied to clipboard
How to report progress when downloading a model?
I want to display a GLB file which is downloaded from the Internet. The download takes some time, so I'd like to inform the user about the progress. How to do that? I see that the Renderable.Builder
has the field private LoadGltfListener loadGltfListener
, but there's no method to set its value and I think that this listener is never notified. Apart from that it can't be used to report progress. It has a method like void reportBytesDownloaded(long bytes)
, but there's no information about the file total size.
Hi! Yes, as you've mentioned reporting the download progress isn't currently supported. However, we may consider this as an improvement for the new SceneView library. We are using Fuel as an HTTP client there and it can report progress: https://github.com/kittinunf/fuel/blob/master/fuel/README.md#adding-progress-callbacks
ResourceLoader.fuelManager.addRequestInterceptor { { request: Request ->
request.requestProgress { readBytes, totalBytes -> }
}}
BUT on Sceneform (not on SceneView), models are still loaded with the old CompletableFuture
way.
You can use the ResourceLoader and create your model from the byte result our use your own download way.
Have a look at the ResourceLoader class to load the byte buffer from any source including Fuel when it's an http/https url
https://github.com/SceneView/sceneform-android/blob/master/core/src/main/java/com/gorisse/thomas/sceneform/util/ResourceLoader.kt#L14-L41
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.