Reputation: 41
I'm using kotlin language with jetpack compose for android app I create main activity with exoplayer library to show video and some buttons every button have url video i want when i click any button on run time show the exactly video it have by exoplayer library
Upvotes: 0
Views: 924
Reputation: 95
Well I have fixed this by using:
viewModel.scope.launch {
exoPlayer.setMediaItem(MediaItem.fromUri("videoUrl"))
}
and my viewModel.scope is set by:
viewModel.scope = rememberCoroutineScope()
Hope this helps
Upvotes: 0