Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Sep 5, 2022 · 20 comments

Comments

@hasnainkanji
Copy link

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
Copy link

I have the same issue

@FreestyleRR
Copy link

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
Copy link
Author

@FreestyleRR which Animation are you using?

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

@FreestyleRR
Copy link

FreestyleRR commented Sep 6, 2022

@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:
#1627

@calda
Copy link
Member

calda commented Sep 6, 2022

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
Copy link
Author

hasnainkanji commented Sep 7, 2022

    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
Copy link

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
Copy link
Contributor

AlexanderKvamme commented Sep 19, 2022

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
Copy link
Member

calda commented Sep 19, 2022

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
Copy link
Author

hasnainkanji commented Sep 20, 2022

Even after this, the animation is not loaded correctly.

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

EXPECTED

Screen.Recording.2022-09-20.at.1.05.57.PM.mov

@calda
Copy link
Member

calda commented Sep 20, 2022

Yes, #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
Copy link
Author

hasnainkanji commented Sep 23, 2022

@calda

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

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

@calda
Copy link
Member

calda commented Sep 23, 2022

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
Copy link
Author

hasnainkanji commented Sep 23, 2022

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

@calda
Copy link
Member

calda commented Sep 23, 2022

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

@hasnainkanji
Copy link
Author

Still it's same
Screen Shot 2022-09-26 at 11 14 51 AM

@jorgealegre
Copy link

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

@kirtiios
Copy link

i have same problem ,any one find solution

@jorgealegre
Copy link

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
Copy link

I was having the same issue while using Lottie 3.4.3.

Updating to 4.2.0 solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants