11

I have a problem, I can only create thumbnails of local video files but not of a remote url, here is my code:

bmThumbnail = ThumbnailUtils.extractThumbnail(ThumbnailUtils.createVideoThumbnail("http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4", MediaStore.Video.Thumbnails.MINI_KIND), 50, 50);

I hope you can help me,

regards christian

user1836363
  • 295
  • 1
  • 5
  • 13
  • I guess you need to download the video first – sdabet Nov 23 '12 at 18:01
  • You need to download the image and then display it in imageview. I guess that should help you. To download you can use asynctask. – Raghunandan Nov 23 '12 at 18:02
  • You will have to capture a frame and then display the thumbnail with it. http://stackoverflow.com/questions/5337505/android-capture-video-frame. If you can download a image form url then you can display the it in imageview. Otherwise download a part of the image, capture a frame and display the thubnail. – Raghunandan Nov 23 '12 at 18:15
  • @Raghunandan but you need to download the video before capturing any frame... – sdabet Nov 23 '12 at 18:47
  • @fiddler i agree with you. typing mistake. To display a frame you need to download the video. – Raghunandan Nov 24 '12 at 10:16
  • This can be helpful : [See This Stack's Answer](http://stackoverflow.com/a/32689023/6067690) – Istiyak Jun 12 '16 at 09:58

3 Answers3

5

I suppose there is no easy way to build the thumbnail without actually downloading the video locally.

So if your question is 'Can I get a thumbnail without having to download the full video?', I'd say...no.

Otherwise, once you have downloaded the video locally, then I guess you can perfectly use ThumbnailUtils.createVideoThumbnail(...) by giving the path to the downloaded file.

sdabet
  • 18,360
  • 11
  • 89
  • 158
5

I also have the same problem - but what can I say from my tests:

  1. The problem occurs only on android >2.3
  2. in android 2.0 -> 2.3 You can use just

Bitmap thumbnail = ThumbnailUtils.createVideoThumbnail( videoUrl, MediaStore.Video.Thumbnails.MINI_KIND);

I hope someone explain what change is on android 4. it doesn't work

anuj arora
  • 831
  • 12
  • 22
1

I have no problem generating thumbnails from remote videos with the following code:

final Bitmap thumbnail = ThumbnailUtils.createVideoThumbnail( videoUrl, MediaStore.Video.Thumbnails.MINI_KIND );

You don't have to wrap an extractThumbnail() call around it

JesperB
  • 4,625
  • 1
  • 36
  • 40