Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fresco Android GIF/WEBP animation not playing

Tags:

android

fresco

I decided to use Fresco as it offers solution to my problem: GIF and WEBP playback.

According to the documentation: http://frescolib.org/docs/animations.html

I can use these codes to automatically play animation:

   Uri uri;
   DraweeController controller = Fresco.newDraweeControllerBuilder()
       .setUri(uri)
       .setAutoPlayAnimations(true)
       . // other setters
       .build();
   mSimpleDraweeView.setController(controller);

However, when I used the code, it only displays the static image.

Are there any other steps I need to do in order to play the GIF/WEBP? or am I misunderstanding the documentation's use of 'animation'?

EDIT:

Additional info, upon using a ControllerListener, I found out that the Animatable return in onFinalImageSet() is null. I'm not sure why.

I also tried running this sample project but also the .gif doesn't animate: https://github.com/kaedea/fresco-sample-usage

I'm using a Nexus 5X for testing btw (version 6.0.1)

like image 900
kishidp Avatar asked Mar 12 '23 10:03

kishidp


1 Answers

Make sure that you add the Gradle dependencies for animations:

dependencies {
  // If your app supports Android versions before Ice Cream Sandwich (API level 14)
  compile 'com.facebook.fresco:animated-base-support:1.2.0'

  // For animated GIF support
  compile 'com.facebook.fresco:animated-gif:1.2.0'

  // For WebP support, including animated WebP
  compile 'com.facebook.fresco:animated-webp:1.2.0'
  compile 'com.facebook.fresco:webpsupport:1.2.0'

  // For WebP support, without animations
  compile 'com.facebook.fresco:webpsupport:1.2.0'
}
like image 118
Alexander Oprisnik Avatar answered Mar 28 '23 22:03

Alexander Oprisnik