Hello guys, How can I get a video thumbnail from uri and display it in ImageView(recyclerView). I have tried the following:
@Override
public void onBindViewHolder(...){
Video video = videolist.get(position);
//Other methods...
Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(video.getVideoUri,MediaStore.Video.Thumbnail.FULL_SCREEN_KIND);
String result = bitmap.toString();
Glide.with(theContext).load(result).into(holder.imageview);
}
And
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(video.getVideoUri));
Bitmap bitmap = retriever.getFrameAtTime(2000000, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
String result = bitmap.toString();
Glide.load(theContext).load(result).into(holder.imageview);
But none of them is working. Any help will be appreciated