Created
September 4, 2021 16:19
-
-
Save rubenquadros/de9019629ef8fb357e65e07aa44bf483 to your computer and use it in GitHub Desktop.
Showing game video and playlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalAnimationApi | |
@Composable | |
fun ShowGameVideos(gameVideos: GameVideosEntity) { | |
val playingIndex = remember { mutableStateOf(0) } | |
// keep track of current playing video | |
fun onVideoChange(index: Int) { | |
playingIndex.value = index | |
} | |
Column(modifier = Modifier.fillMaxSize()) { | |
VideoPlayer( | |
modifier = | |
Modifier.fillMaxWidth() | |
.weight(1f, fill = true) | |
.background(Color.Black), | |
gameVideos = gameVideos.results, | |
currentPlaying = playingIndex, | |
onVideoChange = { newIndex -> | |
onVideoChange(newIndex) | |
} | |
) | |
VideoPlayList( | |
Modifier.fillMaxWidth().weight(1f, fill = true), | |
gameVideos = gameVideos.results, | |
currentPlaying = playingIndex, | |
onVideoChange = { newIndex -> | |
onVideoChange(newIndex) | |
} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment