Glide load thumbnail not working

隐身守侯 提交于 2019-12-03 12:32:49

Even i stumbled upon the same situation. Somehow from the uri its not loading the image unless create a file instance using local file path. So to make it work i used it like below

Glide.with(mContext).load(Uri.fromFile(new File(path)).into(icon);

In the doc they are using the same approach. You can refer here : Glide - Videos

Apart from that i also noticed unusual behaviour of using the cache. If you are using cache strategy as DiskCacheStrategy.ALL or DiskCacheStrategy.SOURCE it doesn't load the thumbnail but if i am using DiskCacheStrategy.RESULT it works. Hope it helps

You can use override, which surely works:

Glide.with(context)
         .load(url)
         .crossFade()
         .override(width, height)
         .into(imageView);

As explained in Glide documentation, this feature is only available for videos stored locally on the device.

Also, you should use a path like /storage/emulated/0/Pictures/example_video.mp4. Adding file:/// before this path won't work out either.

You can find more informations here : https://futurestud.io/blog/glide-displaying-gifs-and-videos

Cheers !

Glide.with(mcontext)
                .applyDefaultRequestOptions(RequestOptions.centerCropTransform()
                        .diskCacheStrategy(DiskCacheStrategy.RESOURCE))
                .load(videourl)
                .into(thumbnailimg);

Try using this code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!