I m getting this error " getFrameAtTime: videoFrame is a NULL pointer " Below is my code. Any suggestion to fix this error
ImageView img = (ImageView) findViewById(R.id.picutre);
try {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource("/storage/sdcard0/download/videos/kamran.ts");
Bitmap bMap = retriever.getFrameAtTime(0,MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
img.setImageBitmap(bMap);
}
catch(Exception e){
Log.d("File","Error Creating image",e);
}
I have also tried these two methods but getting the same error message (getFrameAtTime: videoFrame is a NULL pointer)
Bitmap bMap = ThumbnailUtils.createVideoThumbnail("/storage/sdcard0/download/videos/kamran.ts", MediaStore.Video.Thumbnails.MICRO_KIND);
Bitmap bMap = ThumbnailUtils.createVideoThumbnail("/storage/sdcard0/download/videos/kamran.ts", Thumbnails.FULL_SCREEN_KIND);