Skip to content

Content scale error #49

@HungTD-Apero

Description

@HungTD-Apero

I tried the lib with multiple VideoPlayerSurface and with some video that require scale, the content just overflow to the adjacent view:

Image

Image

Here's the code:

@Composable
internal fun ExploreTab() {
    val url = buildList {
        add("https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4")
        add("https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4")
        add("https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4")
        add("https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4")
        add("https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4")
    }
    val contentScales = buildList {
        add(ContentScale.Crop)
        add(ContentScale.Crop)
        add(ContentScale.FillWidth)
        add(ContentScale.FillHeight)
        add(ContentScale.FillBounds)
    }
    LazyVerticalGrid(
        GridCells.Fixed(2),
        modifier = Modifier.fillMaxSize().offset(y = 120.dp),
        verticalArrangement = Arrangement.spacedBy(20.dp),
        horizontalArrangement = Arrangement.spacedBy(20.dp)
    ) {
        itemsIndexed(url) { index, item ->
            val videoController = rememberVideoPlayerState()
            VideoPlayerSurface(videoController, modifier = Modifier.fillMaxWidth().clipToBounds().aspectRatio(1/1f).background(
                Color.White), contentScale = contentScales[index])
            LaunchedEffect(Unit) {
                videoController.loop = true
                videoController.openUri(item)
                videoController.play()
            }
        }
    }
}

Tried with normal Row and got the same result

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions