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

[Bug] Animated GIF files do not play on iOS/macOS #866

Closed
mattleibow opened this issue Apr 27, 2021 · 41 comments · Fixed by #19411
Closed

[Bug] Animated GIF files do not play on iOS/macOS #866

mattleibow opened this issue Apr 27, 2021 · 41 comments · Fixed by #19411
Assignees
Labels
area-controls-image Image control fixed-in-8.0.10 fixed-in-9.0.0-preview.2.10293 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@mattleibow
Copy link
Member

mattleibow commented Apr 27, 2021

Description

The iOS platform does not yet have the logic to load animated images correctly. Right now it only gets the first frame.

Steps to Reproduce

  1. Add an image element
  2. Set the source to an animated gif
  3. Observe the image load, but not play

Expected Behavior

Animation plays.

Actual Behavior

Only the first frame shows.

Workaround

#866 (comment)

@mattleibow mattleibow added the t/bug Something isn't working label Apr 27, 2021
@Redth Redth added the area-image Image loading, sources, caching label Aug 5, 2021
@shimingsg
Copy link

verified with VS 17.2.0 Preview 2.0 [32224.339.main] in Android 12, windows and IOS 15.2:
the image only gets the first frame.
repro demo: 866.zip

@shimingsg shimingsg added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Feb 28, 2022
@mattleibow mattleibow self-assigned this Mar 1, 2022
@mattleibow mattleibow added this to the 6.0.300 milestone Mar 22, 2022
@jfversluis jfversluis changed the title [Bug] Animated GIF files do not play on iOS [Bug] Animated GIF files do not play on any platform Mar 23, 2022
@jfversluis jfversluis added s/triaged Issue has been reviewed and removed platform/iOS 🍎 labels Mar 23, 2022
@Redth Redth modified the milestones: 6.0.300, 6.0.300-servicing Apr 21, 2022
@angelru
Copy link

angelru commented May 11, 2022

This is still unresolved in RC3?

@mattleibow
Copy link
Member Author

Let me have a look at this... It should be working on android at least because we don't do anything and hand it off to glide.

@mattleibow mattleibow changed the title [Bug] Animated GIF files do not play on any platform [Bug] Animated GIF files do not play on iOS May 11, 2022
@angelru
Copy link

angelru commented May 11, 2022

In windows I have noticed that it does not work either

@mattleibow
Copy link
Member Author

Looking at this now. I got ideas as to where....

The first issue is that we convert gif to png :)

Try adding this:

<MauiImage Update="Resources\Images\*.gif" Resize="False" />

or whatever the path to the gif is. Basically set Resize=false to get it to work. I am seeing windows play gif here when I do that.

@angelru
Copy link

angelru commented May 11, 2022

Looking at this now. I got ideas as to where....

The first issue is that we convert gif to png :)

Try adding this:

<MauiImage Update="Resources\Images\*.gif" Resize="False" />

or whatever the path to the gif is. Basically set Resize=false to get it to work. I am seeing windows play gif here when I do that.

Now if it works, thanks, is it the correct way to do it or do we have to wait for another RC/GA to solve this problem?

@mattleibow
Copy link
Member Author

This is the correct way, but I will also make this the default so you don't have to do it. There are a few properties on MauiImage that can control how it is resized and if at all.

@angelru
Copy link

angelru commented May 12, 2022

This is the correct way, but I will also make this the default so you don't have to do it. There are a few properties on MauiImage that can control how it is resized and if at all.

on macOS desktop it doesn't work either

@mattleibow mattleibow changed the title [Bug] Animated GIF files do not play on iOS [Bug] Animated GIF files do not play on iOS/macOS May 13, 2022
@MuneeshKumarG
Copy link

I have checked gif image in .Net Maui RC3. With below work around, gif working fine with WinUI.

But still issue reproducing in Android.

@samhouts samhouts added this to the .NET 8 SR3 milestone Oct 3, 2023
@ledwardsfoodzee
Copy link

Has this been fixed yet for IOS ? running this on .NET 8 and still can't render GIF's

@akycdi
Copy link

akycdi commented Nov 30, 2023

@ledwardsfoodzee Nope still haven't fixed it on IOS but works well with Android

@billreiss
Copy link

billreiss commented Dec 8, 2023

I've had some luck using WebView to display GIFs on iOS and Android, I am working on a sample, if anyone needs something sooner let me know.

Basically I build the HTML content on the fly based on the filename of the GIF file. In order to get it to work I needed to set the build action for the gif files to MauiAsset instead of MauiImage, if you do this, then you can load them in the WebView just by specifying the filename.

@ledwards26
Copy link

I’d love a sample if you have one?

@naaeef
Copy link

naaeef commented Dec 8, 2023

Hi @ledwards26
What worked for me was writting a custom image handler with the code from the following PR #17207

@Redth Redth modified the milestones: .NET 8 SR3, .NET 8 SR2 Dec 13, 2023
@Redth Redth moved this from Todo to In Progress in MAUI SDK Ongoing Dec 13, 2023
@mattleibow mattleibow added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Dec 13, 2023
@billreiss
Copy link

Here is my sample of using the WebView on iOS to load the GIF file. https://github.com/billreiss/MauiGifWebView

@markmccaigue
Copy link

Hi @mattleibow this is a feature we'd love to see. Just curious what the latest thoughts are within the team regarding the two PRs?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-image Image control fixed-in-8.0.10 fixed-in-9.0.0-preview.2.10293 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Done