I'm budiling an application and it lists all the videos i recorded using the recorder in a list. Is it possible for me to create a thumbnail with the help of Uri instead of the string???
my current code goes as below but it no longer works as my input to the constructor is Uri not string.
bmThumbnail = ThumbnailUtils.createVideoThumbnail(
(db_results.get(position)), Thumbnails.MICRO_KIND);
imageThumbnail.setImageBitmap(bmThumbnail);
I'm returned the error
The method createVideoThumbnail(String, int) in the type ThumbnailUtils is not applicable for the arguments (Uri, int)
Thanks for your time in advance.
Bitmap thumb = ThumbnailUtils. createVideoThumbnail(filePath, Thumbnails. MINI_KIND);
Making a video thumbnail is relatively straightforward. You can take a screenshot from your video that best explains its contents, or you can use a tool like Photoshop or Canva to overlay text or icons on the image. To make a screen capture on a PC, use the Windows Snipping Tool.
Many of the application are using the Glide library for loading the Image and Video thumbnail. You can download the Glide Library from here and alternatively, you can include the library directly in your app using Gradle.
public String getRealPathFromURI(Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(contentUri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With