Skip to content

Instantly share code, notes, and snippets.

@rubenquadros
Created July 31, 2022 11:47
Show Gist options
  • Save rubenquadros/ea4dd61c61f1a60361df90dae1bc1993 to your computer and use it in GitHub Desktop.
Save rubenquadros/ea4dd61c61f1a60361df90dae1bc1993 to your computer and use it in GitHub Desktop.
Center controls for player view
@Composable
fun PlayerControls(modifier: Modifier = Modifier) {
//black overlay across the video player
Box(modifier = modifier.background(Color.Black.copy(alpha = 0.6f))) {
Row(
modifier = Modifier.align(Alignment.Center).fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
) {
//replay button
IconButton(modifier = Modifier.size(40.dp), onClick = {}) {
Image(
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop,
painter = painterResource(id = R.drawable.ic_replay_5),
contentDescription = "Replay 5 seconds"
)
}
//pause/play toggle button
IconButton(modifier = Modifier.size(40.dp), onClick = {}) {
Image(
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop,
painter = painterResource(id = R.drawable.ic_play),
contentDescription = "Play/Pause"
)
}
//forward button
IconButton(modifier = Modifier.size(40.dp), onClick = {}) {
Image(
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop,
painter = painterResource(id = R.drawable.ic_forward_10),
contentDescription = "Forward 10 seconds"
)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment