Lottie-ios: Can we load json and images from remote server to render animation in iOS?

Created on 3 Apr 2018  ·  12Comments  ·  Source: airbnb/lottie-ios

Check these before submitting:

  • [] Updated to the latest version of Lottie (2.5.0)
  • [] The issue doesn't involve an Unsupported Feature
  • [] This issue isn't related to another open issue

This issue is a:

  • [] Non-Crashing Bug (Visual or otherwise)
  • [] Crashing Bug
  • [] Feature Request
  • [] Regression (Something that once worked, but doesn't work anymore)

What Platform are you on?

  • [] MacOS
  • [] iOS

Expected Behavior

Actual Behavior

Code Example

Animation JSON

All 12 comments

Can we load json and images from remote server to render lottie animations in iOS?

yes,I'm using the lib just like this

Can i see sample code for that

On 08-Apr-2018 6:16 PM, "Lee, Bo" notifications@github.com wrote:

yes,I'm using the lib just like this


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/airbnb/lottie-ios/issues/600#issuecomment-379547939,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEwfWJU81vmwg2hrKnBG7BdHQ3DqsymZks5tmgangaJpZM4TFeUV
.

Hello Lee,

I added code for load images from remote server to render dynamic lottie json animations in iOS from remote server.

Could you please review and commit on lottie frame work

@buba447 These do not support remote images resource rendering. Just support only JSON file resource.

If I'm right - (nonnull instancetype)initWithContentsOfURL:(nonnull NSURL *)url; does:
LOTComposition *laScene = [[LOTComposition alloc] initWithJSON:animationJSON withAssetBundle:[NSBundle mainBundle]];, so the assets are still loaded from the main bundle. Are you gonna add the feature somehow in future, or should I try to tailor it and make a PR? Thank you

Hi @premyslvlcek. Have you got any possible solution for loading the images directly from the URL? Any help is appreciated.

yes , i modified few methods in lottie library to get it work.

Thanks,
kanakaraju

On Sat, Jun 30, 2018 at 1:21 AM, Bhavuk Jain notifications@github.com
wrote:

Hi @premyslvlcek https://github.com/premyslvlcek. Have you got any
possible solution for loading the images directly from the URL? Any help is
appreciated.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/airbnb/lottie-ios/issues/600#issuecomment-401456880,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEwfWKSaxnjXpF-VtNXCVEBZSZyLqRRxks5uBoVNgaJpZM4TFeUV
.

Hey @bhavukjain1, feel free to check my fork of this library, which adds support for loading images from dictionary. The key in the dictionary is the name of the image in the lottie json, for example img_01.png. The code is not final, but it works, sorry if there are some bugs, I haven’t seen obj-c for long time. It doesn’t support loading from the url, but you can load the image from the remote url yourself and then put it into the dictionary. See method called: “(nonnull instancetype)animationFromJSON:(nullable NSDictionary *)animationJSON assets:(nullable NSDictionary *)assetsDictionary NS_SWIFT_NAME(init(json:assets:));”

https://github.com/premyslvlcek/lottie-ios/tree/imagesOutsideBundles?files=1

Hey @premyslvlcek. Great work! Works perfectly, thanks.

Does anyone know how to load json files from firebase

Was this page helpful?
0 / 5 - 0 ratings