Florian Malapel
05/14/2024, 12:58 PMresizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
)
My issue is that the next page's video is overlapping the content of my current page (see the white rectangle), I don't succeed to clip the video inside my card keeping the zoom resizeMode, any ideas ?
HorizontalPager(
modifier = Modifier.fillMaxWidth().fillMaxHeight().background(Color.Green),
state = pagerState,
pageSpacing = 10.dp,
pageSize = PageSize.Fixed(maxWidth * 0.7f),
contentPadding = PaddingValues(horizontal = (maxWidth * 0.3f) / 2),
) { page ->
val pageOffset = ((pagerState.currentPage - page) + pagerState.currentPageOffsetFraction).absoluteValue
PMExercicePage(
offset = pageOffset,
modifier = Modifier.fillMaxWidth().fillMaxHeight()
.graphicsLayer {
scaleX = lerp(
start = 0.85f,
stop = 1f,
fraction = 1f - pageOffset.coerceIn(0f, 1f)
)
scaleY = lerp(
start = 0.85f,
stop = 1f,
fraction = 1f - pageOffset.coerceIn(0f, 1f)
)
},
onClick = onClick,
)
}
PMExercicePage contains:
AndroidView(
factory = { context ->
PlayerView(context).apply {
player = exoPlayer
player?.playWhenReady = true
hideController()
useController = false
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
}
},
modifier = modifier,
)