airbnb / lottie-ios

An iOS library to natively render After Effects vector animations
http://airbnb.io/lottie/
Apache License 2.0
25.76k stars 3.75k forks source link

The Main Thread rendering engine doesn't currently support repeaters. To play an animation with repeaters, you can use the Core Animation rendering engine instead #1739

Open hasnainkanji opened 2 years ago

hasnainkanji commented 2 years ago

Hi, I am getting this error.

Lottie/ItemsExtension.swift:83: Fatal error: The Main Thread rendering engine doesn't currently support repeaters. To play an animation with repeaters, you can use the Core Animation rendering engine instead. 2022-09-05 21:45:24.501920+0400 Demo[46949:6094753] Lottie/ItemsExtension.swift:83: Fatal error: The Main Thread rendering engine doesn't currently support repeaters. To play an animation with repeaters, you can use the Core Animation rendering engine instead.

Which Version of Lottie are you using?

Lottie 3.4.3

Animation JSON

https://lottiefiles.com/59461-heart-beat-pop-up

Screen Shot 2022-09-05 at 9 48 53 PM
FreestyleRR commented 2 years ago

I have the same issue

FreestyleRR commented 2 years ago

Hi, I am getting this error.

Lottie/ItemsExtension.swift:83: Fatal error: The Main Thread rendering engine doesn't currently support repeaters. To play an animation with repeaters, you can use the Core Animation rendering engine instead. 2022-09-05 21:45:24.501920+0400 Demo[46949:6094753] Lottie/ItemsExtension.swift:83: Fatal error: The Main Thread rendering engine doesn't currently support repeaters. To play an animation with repeaters, you can use the Core Animation rendering engine instead.

Which Version of Lottie are you using?

Lottie 3.4.3

Animation JSON

https://lottiefiles.com/59461-heart-beat-pop-up

Screen Shot 2022-09-05 at 9 48 53 PM

I fixed this issue. Try this: AppDelegate -> LottieConfiguration.shared.renderingEngine = .automatic

hasnainkanji commented 2 years ago

@FreestyleRR which Animation are you using?

Still, it is not working for me. For the mentioned above json.

FreestyleRR commented 2 years ago

@FreestyleRR which Animation are you using?

Still, it is not working for me. For the mentioned above json.

Json animation and I have the same issue But it helped me. Try this - let animationView = AnimationView( animation: ..., configuration: LottieConfiguration(renderingEngine: .automatic) ) Maybe this link helped you: https://github.com/airbnb/lottie-ios/discussions/1627

calda commented 2 years ago

Support for repeaters is currently only implemented for the new Core Animation rendering engine, which you currently have to enable manually as mentioned above (in Lottie 4.0 it will be enabled by default). It should be possible to implement repeater support for the Main Thread rendering engine though -- PRs are welcome if anyone wants to give it a shot.

hasnainkanji commented 2 years ago
    let animation = Animation.named("favourite_car", bundle: .main, subdirectory: nil, animationCache: nil)
    self.animationView = AnimationView(animation: animation,
                                       configuration: LottieConfiguration(renderingEngine: .automatica))
    animationView!.frame = animatedView.bounds
    animationView!.contentMode = .scaleAspectFit
    animationView!.loopMode = .loop
    animationView!.animationSpeed = 0.5
    animatedView.addSubview(animationView!)
    animationView!.play()

@FreestyleRR above is the code snippet, but still the same crash.

Ronaldoh1 commented 2 years ago

I've got the same issue.

Lottie/ItemsExtension.swift:83: Fatal error: The Main Thread rendering engine doesn't currently support repeaters. To play an animation with repeaters, you can use the Core Animation rendering engine instead.

just trying to render on a viewController...all it's doing is presenting the animation view.

AlexanderKvamme commented 2 years ago

I am also experiencing this crash while instantiating the animationView like this: AnimationView(animation: Lottie.lottieLoadingIndicator, configuration: LottieConfiguration(renderingEngine: .automatic)). Is there anything else that needs to be done?

@kanji-dubizzle Did you resolve the issue on your end?

calda commented 2 years ago

We could change this to be a warning that prints to console (LottieLogger.shared.warn) instead of an assertion that crashes in debug (LottieLogger.shared.assertionFailure). It seems like there were a lot of folks using animations with silently-hidden repeaters, and we shouldn't break their use case.

Is anyone interested in making a pull request for this change? It should be a one-liner 😄

hasnainkanji commented 2 years ago

Even after this, the animation is not loaded correctly.

Screen Recording 2022-09-20 at 12 07 11 PM

EXPECTED

https://user-images.githubusercontent.com/81670605/191203015-99ac9586-ba13-432e-bbb9-09dc347d56c6.mov

calda commented 2 years ago

Yes, https://github.com/airbnb/lottie-ios/pull/1754 only prevents the "unsupported" warning message from crashing the app in debug builds.

@kanji-dubizzle, have you tried playing your animation with the Core Animation rendering engine? That implementation supports repeaters.

hasnainkanji commented 2 years ago

@calda

is crashing .coreAnimation, is there anything I am doing wrong?

Screen Shot 2022-09-23 at 2 21 34 PM

calda commented 2 years ago

It looks like your animation uses features that aren't supported yet by the Core Animation rendering engine. What version of Lottie are you using? Could you share a copy of your animation?

hasnainkanji commented 2 years ago

3.4.2. Link to animation: https://lottiefiles.com/59461-heart-beat-pop-up

calda commented 2 years ago

Could you test your animation on the latest version, 3.4.3?

hasnainkanji commented 2 years ago

Still it's same

Screen Shot 2022-09-26 at 11 14 51 AM
jorgealegre commented 2 years ago

I'm also having the same problem with an animation file. What makes an animation not work with Core Animation?

kirtiios commented 2 years ago

i have same problem ,any one find solution

jorgealegre commented 2 years ago

We ended up replacing our animation with one that looks exactly the same but with a different implementation from the designer and got really good results.

bogdan-razvan commented 1 year ago

I was having the same issue while using Lottie 3.4.3.

Updating to 4.2.0 solved the issue.