Reputation: 11
I am trying to generate a thumbnail of the video. But I cannot use Glide as it colliding with other gallery libraries.
I have tried Picasso that is not giving me thumbnail from the URL. ThumbnailUtils.createVideoThumbnail
is working in my code but it is too slow.
Can someone suggest any effective tool or technique, to get the thumbnail from the URL in java??
Upvotes: 1
Views: 351
Reputation: 5443
You can use the MediaMetadataRetriever
class. For example
private fun getThumbNail(uri: Uri): Bitmap {
val retriever = MediaMetadataRetriever()
retriever.setDataSource(context, uri)
return retriever.frameAtTime //or frameAtPosition(..)/frameAtIndex(..)
}
Upvotes: 1