1

Hello everyone, I want to programmatically create a thumbnail while the video is uploading process and save it for that thumbnail in my firebase storage. I have successfully done to create the thumbnail in large HD IMAGES, but when I tried to create a thumbnail in Video, sometimes my application is crashed, also

Glide.with(context).load(filePath).error(R.drawable.error).into(imageView); 

or

Bitmap thumb = ThumbnailUtils.createVideoThumbnail(file.getAbsolutePath(), MediaStore.Video.Thumbnails.MINI_KIND); 
imageView.setImageBitmap(thumb);

also not working, also I want to show the thumbnail of the video but still does not show any values.

And The Bitmap shows me a null value.

Anybody, Could You Please Help Me To Solve this problem.

Balwant Chandel
  • 101
  • 1
  • 7
  • Are you sure the video container that's uploading does support accessing without being written to disk completely? mp4 and mov don't do this by default, you'd need to wait until the file is written. – Harry Apr 01 '18 at 12:43
  • I tried it multiple times, but every time my effort is failed. I want similar thumbnail like youtube , first upload the video then create a video thumbnail images programatically,I tried it but still I have a same problem. It's not be resolved , so guys help me to resolve this challenge... – Balwant Chandel Apr 01 '18 at 18:37
  • You need to post some more code so we can help you. BUT first please wait until the video is uploaded completely, then try to get the thumbnail like here: https://stackoverflow.com/questions/41377129/thumbnailutils-createvideothumbnail-returns-null-for-existing-mp4-video – Harry Apr 01 '18 at 18:48
  • Dear Harry, I used this simple code to just retrieve a video thumbnail. imageView = (ImageView) findViewById(R.id.imageView); String videoPath = "android.resources://com.example.javasmartsupport.earnvideo/raw/satta.mp4"; File videoFile = new File(videoPath); Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(videoFile.getAbsolutePath(), MediaStore.Video.Thumbnails.FULL_SCREEN_KIND); – Balwant Chandel Apr 01 '18 at 19:08
  • It should work then, so unfortunately you need to add more infos. What about the time when you execute this code, is the video static at this point? Are you sure that the phone supports the video format/codec? – Harry Apr 01 '18 at 19:19
  • yes, phone supported the video formats and i have a multiple videos with .mp4 formats, ThumbnailUtils.createVideoThumbnail it return null values – Balwant Chandel Apr 01 '18 at 23:27
  • how do you suppose us to help you if you do not add more infos? The 2 lines of code you posted are not your problem. – Harry Apr 02 '18 at 09:43

0 Answers0