Reputation: 1527
My code looked like this:
GlideApp.with(c)
.asGif()
.load(pathToPicture)
.into(memePicView);
This netted me the following stacktrace
W/Glide: Load failed for https://img.memecdn.com/japan-strikes-again_webm_3923465.gif with size [-2147483648x-2147483648]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ContentLengthInputStream->GifDrawable->GifDrawable}, REMOTE
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ContentLengthInputStream->GifDrawable->GifDrawable}
I could access said gif from the browser, and the size of that gif is not [-2147483648x-2147483648]
. Was there some setting that I missed, and do I have to implement an okhttp
or Volley
integrated App Glide Module?
And I do have the Internet permission in my Manifest. In case anyone asks.
I've tried downloading the GIF into the app's internal data directory and loading it from there with Glide. Still no dice with the exact same error, except replace ContentLengthInputStream with FileInputStream.
Upvotes: 3
Views: 2550
Reputation: 3642
To fix this kind of problem with Gif-images loading try to use
options.set(GifOptions.DISABLE_ANIMATION, false)
For example (Kotlin):
GlideApp.with(c)
.asGif()
.load(pathToPicture)
.into(memePicView)
change to:
GlideApp.with(c)
.asGif().apply {
options.set(GifOptions.DISABLE_ANIMATION, false)
}
.load(pathToPicture)
.into(memePicView)
Upvotes: 0
Reputation: 7387
https://img.memecdn.com/japan-strikes-again_webm_3923465.gif is not a GIF. It looks like a webm, which is a movie format. Not sure why, but lots of websites are using the .gif extension for non-gif files, including animated webp and movie files.
Upvotes: 3
Reputation: 2032
Remove asGif() and It will work!
GlideApp.with(c)
.load(pathToPicture)
.into(memePicView);
Refer: https://futurestud.io/tutorials/glide-displaying-gifs-and-videos
Upvotes: 0