airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
35.04k stars 5.41k forks source link

Allow Image Delegate (Remote url loading) for Dotlottie files #2261

Closed kushasahu7 closed 1 year ago

kushasahu7 commented 1 year ago

For external images, hosted on some server, I am using the values "p" and "u" of the json to have the host and file name, something that Lottiefiles offers in their players. For android, I then use an image delegate to fetch images using these values from the asset via glide (Although the composition has image array, none of them have bitmaps, until image delegate is called).

However, this isn't supported for a dotlottie file The current code of the function : fromZipStreamSyncInternal ensures all images bitmaps are being set: https://github.com/airbnb/lottie-android/blob/master/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java#L560

But this check isn't present in "fromJsonReaderSyncInternal", which allows image delegation work to be done.

It would be great if the same support exists in fromZipStreamSyncInternal as well.

(Let me know if I missed understanding some part of the code and this is already supported via something else)

gpeal commented 1 year ago

@kushasahu7 Would lifting the restriction that all images exist be sufficient here?