4

Want to create tumbnails from url from any sites. I am using following code

Bitmap bmThumbnail;
bmThumbnail = ThumbnailUtils.createVideoThumbnail(videoLink, 
MediaStore.Video.Thumbnails.MICRO_KIND);

But its not working,please suggest any other ways if present.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
sushma1008
  • 125
  • 5
  • 14
  • 3
    Possible duplicate of [Is it possible to Generate a thumbnail from a video url in android](https://stackoverflow.com/questions/22954894/is-it-possible-to-generate-a-thumbnail-from-a-video-url-in-android) – AskNilesh Dec 13 '17 at 10:15
  • Possible Duplicate https://stackoverflow.com/questions/23522124/android-display-a-video-thumbnail-from-a-url https://stackoverflow.com/questions/22954894/is-it-possible-to-generate-a-thumbnail-from-a-video-url-in-android Refer Also https://stackoverflow.com/questions/41956167/how-to-load-video-thumbnail-from-video-url-in-listview-adapter https://stackoverflow.com/a/44943830/5018132 – S J Dec 13 '17 at 10:18

2 Answers2

9

Use Glide : https://github.com/bumptech/glide

Shortest Method To get Video thumbnails

RequestOptions requestOptions = new RequestOptions();
requestOptions.isMemoryCacheable();
Glide.with(context).setDefaultRequestOptions(requestOptions).load("Url").into(image);
Zoe
  • 27,060
  • 21
  • 118
  • 148
Nikunj Paradva
  • 15,332
  • 5
  • 54
  • 65
1

If there is youtube url, then we have to make static url to make it thumbnail. https://img.youtube.com/vi/nE4PBsClUrY/0.jpg

nE4PBsClUrY - this is id of video

Using that we can make a thumbnail.

Zoe
  • 27,060
  • 21
  • 118
  • 148
sushma1008
  • 125
  • 5
  • 14