Jan
04/20/2022, 10:30 PMval files = remember { File(parent).listFiles()!!.toList().chunked(4) }
LazyColumn {
items(files.size) {
Row {
files[it].forEach { video ->
Thumbnail(video, size)
}
}
}
}
The problem is that the thumbnail thing takes a bit to load however the lazy column either calls the thumbnail method all at once or I'm doing something wrong because it's not loading. If I only take 4 of files it loads a few seconds and its fineJan
04/20/2022, 10:31 PM@Composable
fun Thumbnail(file: File, size: Dimension) {
var image: BufferedImage? by remember { mutableStateOf(null) }
LaunchedEffect(Unit) {
val picture = FrameGrab.getFrameFromFile(file, 1)
image = AWTUtil.toBufferedImage(picture)!!
}
image?.toComposeImageBitmap()?.let { Image(it, "", Modifier.size((size.width / 4).dp, (size.height / 4).dp)) }
}
Andrey Kulikov
04/20/2022, 11:02 PMJan
04/20/2022, 11:05 PMZach Klippenstein (he/him) [MOD]
04/21/2022, 5:03 PMMutableState
+ LaunchedEffect
with a produceState