Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I create a thumbnail of a video url in android?

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

like image 515
user1836363 Avatar asked Nov 23 '12 17:11

user1836363


3 Answers

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.

like image 139
sdabet Avatar answered Sep 21 '22 18:09

sdabet


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

like image 39
Krzysztof Itaudit Avatar answered Sep 17 '22 18:09

Krzysztof Itaudit


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

like image 23
JesperB Avatar answered Sep 21 '22 18:09

JesperB