Mohamed Elnwishy
Mohamed Elnwishy

Reputation: 41

jetpack compose exoplayer change url on run time

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

Answers (1)

Iets Iets
Iets Iets

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

Related Questions