0

I am trying to load thumbnail in android app using Glide but it is showing blank white thumbnail. I am using the following dependencies

implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

and the buildsript in build.gradle(project) is as

buildscript {
    repositories {
        google()
        jcenter()
    }

In the adapter class in onBindViewHolder the Glide is used as follows

Glide.with(mContext).load(new File(videoFiles.get(position).getPath())).into(holder.thumbnail);

In Logcat it is showing this

There was 1 cause:
    java.io.IOException(File unsuitable for memory mapping)
     call GlideException#logRootCauses(String) for more detail
        Cause (1 of 1): class java.io.IOException: File unsuitable for memory mapping
      Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, LOCAL
    There was 1 cause:

    java.io.FileNotFoundException(Lec.mp4: open failed: ENOENT (No such file or directory))    
     call GlideException#logRootCauses(String) for more detail
        Cause (1 of 1): 
class java.io.FileNotFoundException: Lec.mp4: open failed: ENOENT (No such file or directory)
      Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.os.ParcelFileDescriptor, LOCAL
M Baig
  • 55
  • 7

1 Answers1

0

Glide is used for ImageView. I was reading some articles and visiting web pages to find your answer.

Unfortunately, I haven't get any answer for you. But, I found something which may not help you.

Let me add that webpage link and source codes

String internetUrl = "http://i.imgur.com/DvpvklR.png";

// setup Glide request without the into() method
DrawableRequestBuilder<String> thumbnailRequest = Glide  
    .with(context)
    .load(internetUrl);

// pass the request as a a parameter to the thumbnail request
Glide  
    .with(context)
    .load(UsageExampleGifAndVideos.gifUrl)
    .thumbnail(thumbnailRequest)
    .into(imageView);

Here, you can put Image as thumbnail onto videos or gif. You can't directly get thumbnail from videos or gifs by glide.

I have some source code from my git repo

// Providing Thumbnail For Selected Image
public Bitmap getThumbnailPathForLocalFile(Activity context, Uri fileUri) {
    long fileId = getFileId(context, fileUri);
    return MediaStore.Video.Thumbnails.getThumbnail(context.getContentResolver(),
            fileId, MediaStore.Video.Thumbnails.MICRO_KIND, null);
}

You can get thumbnail from videos by this source code. But, I don't know which moment it creates thumbnail. I guess, random.

I hope you can find your answer here(Stackoverflow)