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)
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'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With