Livedata observer, wait for onResume to complete and then use the data

495 Views Asked by At

I am unable to figure this out. I have scenario, I am getting the video data in background via viewModel, coroutine and result in LiveData. The call to viewModel happens in onViewCreated of fragment. And in onResume I initialise ExoPlayer.

Now if I get the livedata result before onResume has completed and call play() by passing the videoUrl it would fail as ExoPlayer is not initialised yet.

How do I sync up this ?

0

There are 0 best solutions below