Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[BUG] Unable to display Lottie Animation within Popup

Open vhugogarcia opened this issue 3 years ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

I would like to display a Lottie animation within a popup, however, the animation is loaded only on iOS. Android and macOS do not load the Lottie Animation.

Android - The image is not rendered at all. iOS - The image renders and animates properly. macOS - The image renders without animation.

image image image

Please find below a couple of videos showing the issue

https://user-images.githubusercontent.com/1047398/192577026-1872d522-ec10-47d1-bf1a-985ce64643fd.mov

https://user-images.githubusercontent.com/1047398/192577040-89014a88-d76d-4951-8f79-0b82fd14384d.mp4

Expected Behavior

It is expected the Lottie animation to be rendered properly in all platforms within a popup.

Steps To Reproduce

  1. Create a new MAUI project
  2. Add CommunityToolkit.Maui nuget package
  3. Add SkiaSharp.Extended.UI.Maui nuget package (preview)
  4. Create a CommunityToolkit Popup view and add the following code: <skia:SKLottieView Source="loading.json" WidthRequest="200" HeightRequest="200" RepeatCount="-1" VerticalOptions="Center" HorizontalOptions="Center"/>
  5. Use the following Lottie file as animation (Download the JSON file): https://lottiefiles.com/97952-loading-animation-blue
  6. Include the json file into the folder /Resources/Raw
  7. Mark the json file as build action > MauiAsset
  8. Create a page with a button that shows the popup view on a click event

Link to public reproduction project repository

https://github.com/mono/SkiaSharp.Extended/files/9577812/SKLottieViewBug.zip

Environment

- .NET MAUI CommunityToolkit: 1.2.0
- OS:macOS Monterey 12.6
- .NET MAUI: 6.0.486
- SkiaSharp.Extended.UI.Maui 2.0.0-preview.61

Anything else?

Thanks in advance for this AMAZING library!

vhugogarcia avatar Sep 15 '22 13:09 vhugogarcia

Hey @vhugogarcia! We don't have any Lottie tooling in the .NET MAUI Community Toolkit.

Did you perhaps intent to open this Issue on the .NET MAUI repo or the SkiaSharp.Extended repo?

TheCodeTraveler avatar Sep 15 '22 22:09 TheCodeTraveler

Hey @vhugogarcia! We don't have any Lottie tooling in the .NET MAUI Community Toolkit.

Did you perhaps intent to open this Issue on the .NET MAUI repo or the SkiaSharp.Extended repo?

I suggested he open it here. I don't know where the issue lies yet but for now the issue is that the Lottie animation render fine in a .NET MAUI app but not in the toolkits Popup.

bijington avatar Sep 16 '22 05:09 bijington

Thanks Shaun! Could we update the title of this Issue to include the problem? Currently, the title is just [Bug].

TheCodeTraveler avatar Sep 16 '22 21:09 TheCodeTraveler

And add a link to the repro to reproduce

VladislavAntonyuk avatar Sep 17 '22 05:09 VladislavAntonyuk

Thanks Shaun! Could we update the title of this Issue to include the problem? Currently, the title is just [Bug].

Thanks @brminnick . I tried to update the title however, it did not let me do it. Maybe I did it wrong. I apologize.

@VladislavAntonyuk another person published this issue on the Skiasharp repository with a sample: https://github.com/mono/SkiaSharp.Extended/issues/142

I think we are trying to guess if the popup has a limitation to render Skiasharp lottie animations natively or if there is something else involved into.

Thanks @bijington for also looking into.

Really appreciate the support from all of you.

vhugogarcia avatar Sep 19 '22 03:09 vhugogarcia

We will wait until this issue get resolved:

  • https://github.com/mono/SkiaSharp.Extended/issues/147

pictos avatar Oct 17 '22 03:10 pictos

@pictos @bijington I downloaded this repository https://github.com/mono/SkiaSharp.Extended/files/9577812/SKLottieViewBug.zip and I updated it to latest .NET MAUI version 7.0.52 and CommunityToolkit 3.1.0 and after some testing I can confirm a things:

  • On Android, the SkiaSharp lottie animation is now animated as expected within the Popup, see video demo below:

https://user-images.githubusercontent.com/1047398/207465026-b21ec802-252c-4355-b5b3-bc8993fa651a.mov

  • On iOS and macOS, the SkiaShap lottie animation is not animated anymore, it just renders the image in static mode, see video demo below:

https://user-images.githubusercontent.com/1047398/207465310-46ab718a-227c-4290-9685-6eedc7f65d85.mov

I just wanted to share some findings using latest versions of .NET MAUI and Community Toolkit that could probably provide some insights about the issue. Please feel free to close this issue if you believe the current issue on iOS and macOS belongs to the issue you linked: https://github.com/mono/SkiaSharp.Extended/issues/147

Thank you so much for reading me!

vhugogarcia avatar Dec 13 '22 23:12 vhugogarcia

@vhugogarcia sorry for the late reply... I'll take a look on it soon-sh but I hope this can be fixed on the Skia side... Thank you so much for your time and evidences. Hope are having a great holiday season❣️

pictos avatar Dec 27 '22 20:12 pictos

For Info: I got the lottieview to work on iOS when compiled on a MAC build host. I commented my solution here:

https://github.com/mono/SkiaSharp.Extended/issues/142#issuecomment-1364180669

Rgds Vinc

VToegel avatar Jan 11 '23 17:01 VToegel

Thanks @VToegel for sharing this workaround. It solves the issue on Android, iOS and macOS successfully.

Tested on .NET MAUI version 7.0.52 and CommunityToolkit 3.1.0

https://user-images.githubusercontent.com/1047398/211898162-3c85baec-9ab7-49cf-b4e4-8d6f89536045.mov

I don't have a way to test it on Windows. If somebody can give me a hand to test it on Windows 11 would be awesome, please.

@pictos Up to this point, based on the workaround provided by our friend Vincent, I'm not sure if this issue now should still keep open on the community toolkit repo or SkiaSharp.Extended or even if we need to transfer this ticket to the .NET MAUI repository.

From my perspective, this issue can be closed here but I prefer for you Pedro or @brminnick to give us feedback on what will be the next steps on this issue.

THANK YOU to all people helping to solve this issue 💯

vhugogarcia avatar Jan 11 '23 19:01 vhugogarcia

@vhugogarcia I tested it on windows and it does work too.

Rgds Vinc

VToegel avatar Jan 11 '23 22:01 VToegel

Sorry I got distracted and somehow forgot about this issue. Does anyone know what the status is? I see the issue on the skia repo is still open. @vhugogarcia has your workaround lived long enough to become a solution? 😄 Or is there something else we need to take action on?

bijington avatar May 06 '23 12:05 bijington

Hello @bijington, please feel free to close it safely. It works very good now and I have used it on released apps in the stores for iOS and Android successfully 🥳.

Thank you so much for the support!

Update: I just closed it.

vhugogarcia avatar May 06 '23 12:05 vhugogarcia

Excellent news! Thank you

bijington avatar May 06 '23 12:05 bijington

Animation still stays hidden for me but only on the first time the Popup loads. When loading the second time it does show in the Popup. Also when using a CarouselView in the Popup, the animation stays hidden on the first slide. The second, third, etc. all show fine in the Popup. Anyone else had this happening?

Elmigo avatar Feb 13 '24 20:02 Elmigo

Lotties on popups still work with my workaround of async init:

https://github.com/mono/SkiaSharp.Extended/issues/142#issuecomment-1364180669

The problem is the timing in lottie instantiation. Please test.

Rgds

VToegel avatar Feb 15 '24 10:02 VToegel