playback: only save in ongoing session
Otherwise try not to in order to avoid causing state saving to fail.
This commit is contained in:
parent
e73dffcb2a
commit
93dee00285
1 changed files with 6 additions and 2 deletions
|
@ -548,7 +548,9 @@ class ExoPlaybackStateHolder(
|
|||
|
||||
private fun save(cb: () -> Unit) {
|
||||
saveJob {
|
||||
persistenceRepository.saveState(playbackManager.toSavedState())
|
||||
if (sessionOngoing) {
|
||||
persistenceRepository.saveState(playbackManager.toSavedState())
|
||||
}
|
||||
withContext(Dispatchers.Main) { cb() }
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +561,9 @@ class ExoPlaybackStateHolder(
|
|||
delay(SAVE_BUFFER)
|
||||
yield()
|
||||
L.d("Committing saved state")
|
||||
persistenceRepository.saveState(playbackManager.toSavedState())
|
||||
if (sessionOngoing) {
|
||||
persistenceRepository.saveState(playbackManager.toSavedState())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue