Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Final video item
@Composable
fun VideoItem(
index: Int,
video: VideoResultEntity,
currentPlaying: State<Int>,
onVideoChange: (Int) -> Unit
) {
val currentlyPlaying = remember {
mutableStateOf(false)
}
currentlyPlaying.value = index == currentPlaying.value
ConstraintLayout(
modifier =
Modifier.testTag("VideoParent")
.padding(8.dp)
.wrapContentSize()
.clickable {
// notify video player to play this video
onVideoChange(index)
}
) {
// rest of the things remain same
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment