Skip to content

Instantly share code, notes, and snippets.

@rubenquadros
Created September 4, 2021 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenquadros/de9019629ef8fb357e65e07aa44bf483 to your computer and use it in GitHub Desktop.
Save rubenquadros/de9019629ef8fb357e65e07aa44bf483 to your computer and use it in GitHub Desktop.
Showing game video and playlist
@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