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) {
|
private fun save(cb: () -> Unit) {
|
||||||
saveJob {
|
saveJob {
|
||||||
|
if (sessionOngoing) {
|
||||||
persistenceRepository.saveState(playbackManager.toSavedState())
|
persistenceRepository.saveState(playbackManager.toSavedState())
|
||||||
|
}
|
||||||
withContext(Dispatchers.Main) { cb() }
|
withContext(Dispatchers.Main) { cb() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,9 +561,11 @@ class ExoPlaybackStateHolder(
|
||||||
delay(SAVE_BUFFER)
|
delay(SAVE_BUFFER)
|
||||||
yield()
|
yield()
|
||||||
L.d("Committing saved state")
|
L.d("Committing saved state")
|
||||||
|
if (sessionOngoing) {
|
||||||
persistenceRepository.saveState(playbackManager.toSavedState())
|
persistenceRepository.saveState(playbackManager.toSavedState())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun saveJob(block: suspend () -> Unit) {
|
private fun saveJob(block: suspend () -> Unit) {
|
||||||
currentSaveJob?.let {
|
currentSaveJob?.let {
|
||||||
|
|
Loading…
Reference in a new issue