Thumbnail slip does not work

I use Glide to download thumbnails from a video, but it does not seem to work in my application. For some reason, ImageView is just empty.

Glide.with(context) .load(url) .asBitmap() .thumbnail(0.1f) .diskCacheStrategy(DiskCacheStrategy.ALL) .into(target); 

I added a listener so that I can figure out what is wrong, but the exception thrown is null.

I tried using ThumbnailUtils using the same URL, because I thought there might be something wrong with it, but the thumbnails load fine.

Does anyone experience the same thing? I am using Nexus 7 (6.0.1)

+7
android android-glide
source share
4 answers

Even I came across the same situation. Somehow, the image is not loaded from uri unless a file instance is created using the local file path. To make it work, I used it as below

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

In the document, they use the same approach. You can contact here: Glide - Videos

In addition, I also noticed unusual cache usage behavior. If you use a caching strategy like DiskCacheStrategy.ALL or DiskCacheStrategy.SOURCE , it does not load the thumbnail, but if I use DiskCacheStrategy.RESULT , it works. Hope this helps.

+7
source share

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

In addition, you should use a path like /storage/emulated/0/Pictures/example_video.mp4 . Add file:/// until this path works.

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

Greetings!

+1
source share

You can use an override that certainly works:

 Glide.with(context) .load(url) .crossFade() .override(width, height) .into(imageView); 
+1
source share
 Glide.with(mcontext) .applyDefaultRequestOptions(RequestOptions.centerCropTransform() .diskCacheStrategy(DiskCacheStrategy.RESOURCE)) .load(videourl) .into(thumbnailimg); 

Try using this code.

0
source share

All Articles