only show loading cycle when not playing
This commit is contained in:
parent
38ea5560b6
commit
26cb3cf749
|
@ -142,7 +142,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
|||
super.onIsPlayingChanged(isPlaying)
|
||||
Log.d(TAG, "Playing state changed. Is Playing: $isPlaying")
|
||||
mutableUiState.update {
|
||||
it.copy(playing = isPlaying)
|
||||
it.copy(playing = isPlaying, isLoading = false)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,10 +155,12 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
|||
// TODO: This is not correctly applicable for loading indicator
|
||||
override fun onIsLoadingChanged(isLoading: Boolean) {
|
||||
super.onIsLoadingChanged(isLoading)
|
||||
if(!player.isPlaying) {
|
||||
mutableUiState.update {
|
||||
it.copy(isLoading = isLoading)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRepeatModeChanged(repeatMode: Int) {
|
||||
super.onRepeatModeChanged(repeatMode)
|
||||
|
@ -263,7 +265,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
|||
private fun resetHideUiDelayedJob() {
|
||||
uiVisibilityJob?.cancel()
|
||||
uiVisibilityJob = viewModelScope.launch {
|
||||
delay(4000)
|
||||
delay(2000)
|
||||
hideUi()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue