How to Display video thumbnail for videos from local storage of Phone in jetpack compose using Coil
I am trying this code
val painter = rememberAsyncImagePainter(
model = ImageRequest.Builder(LocalContext.current)
.data(videouri)
.fetcherFactory<Any> { data, options, imageLoader ->
imageLoader.components.newBuilder()
.add(VideoFrameDecoder.Factory())
.build()
.newFetcher(data, options, imageLoader)?.first
}
.videoFrameMillis(1000)
.build(),
)
Image(
painter = painter,
contentDescription = "",
contentScale = ContentScale.Crop,
alignment = Alignment.Center,
modifier = Modifier.size(48.dp)
)
The video uri is
ContentUris.withAppendedId(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, idColumn.toLong())
However videothumbnail doesnot show.