Animated Gifs are popular. Providing the image view with features that allowed it to animate gifs would allow users to not have to use webviews or create other custom renderers
Add an AnimationPlayBehaviorProperty for the Image control which indicates that a gif should start playing once it has loaded or if it should be started through other mechanisms.
Add two methods for starting and stopping the animation
public enum ImagePlayBehavior
{
None,
OnLoad
}
public static readonly BindableProperty AnimationPlayBehaviorProperty = BindableProperty.Create(nameof(AnimationPlayBehavior), typeof(ImagePlayBehavior), typeof(Image), ImagePlayBehavior.None);
public void StartAnimation();
public void StopAnimation();
If user has specified they want the animation to play onload or they call StartAnimation then start playing the gif animation
See Android
See Android
Ensure the way the current Image control processes gifs does not change unless the user opts in for the given properties
Work that's been done
https://forums.xamarin.com/discussion/17448/animated-gif-in-image-view
https://github.com/jamesmontemagno/PuppyKittyOverflow/blob/master/PuppyKittyOverflow.Touch/AnimatedImageView.cs
https://github.com/jamesmontemagno/GifImageView-Xamarin.Android
https://github.com/luberda-molinet/FFImageLoading/pull/470/files
Maybe a event for FinishedPlaying
GIF is considered inefficient today. MP4 videos are preferred, because they have much much smaller size than animated GIF, and great quality.
There's a separate ticket for adding a MediaElement control, I think that could be a better option.
This will probably be absorbed by https://github.com/xamarin/Xamarin.Forms/issues/1692 but just to frame this issue the motivation was for chat apps and very simple playback. So user a sends user b a hilarious cat/dog gif they can watch.
@PureWeen I see, emojis / emoticons you mean. That might make sense, they should be very small, not sure.
@PureWeen First incarnation of this will not implement caching or streaming of GIF's so implementation will focus on small GIF's. For larger GIF's, solution will need to be extended with at least streaming support keeping a smaller subset of decoded frames in memory at the same time.
Sounds good .. Caching definitely needs its own issue for discussion and implementation across the whole image system.
This PR for 3.0.0
https://github.com/xamarin/Xamarin.Forms/pull/1973
Should help with gifs that are part of the project but gifs coming in as links or other will still cause some memory bloat
Here's a cool binding Jonathan Peppers put together for GlideX
https://github.com/jonathanpeppers/glidex
Initial implementation proposal, #2202 .
I want to live Sambot