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,352
  • 21
  • 80
  • 110
sushma1008
  • 105
  • 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

8

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 stands with Ukraine
  • 25,310
  • 18
  • 114
  • 149
Nikunj Paradva
  • 13,304
  • 5
  • 51
  • 60
-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 stands with Ukraine
  • 25,310
  • 18
  • 114
  • 149
sushma1008
  • 105
  • 5
  • 14