tasker: fix player main thread bugs on restore
This commit is contained in:
parent
27e378ae2a
commit
cc7f9ba539
1 changed files with 6 additions and 6 deletions
|
@ -164,20 +164,20 @@ class ExoPlaybackStateHolder(
|
|||
logD("Restoring playback state")
|
||||
restoreScope.launch {
|
||||
val state = persistenceRepository.readState()
|
||||
withContext(Dispatchers.Main) {
|
||||
if (state != null) {
|
||||
// Apply the saved state on the main thread to prevent code expecting
|
||||
// state updates on the main thread from crashing.
|
||||
withContext(Dispatchers.Main) {
|
||||
playbackManager.applySavedState(state, false)
|
||||
if (action.play) {
|
||||
playbackManager.playing(true)
|
||||
}
|
||||
}
|
||||
} else if (action.fallback != null) {
|
||||
playbackManager.playDeferred(action.fallback)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Shuffle all -> Start new playback from all songs
|
||||
is DeferredPlayback.ShuffleAll -> {
|
||||
logD("Shuffling all tracks")
|
||||
|
|
Loading…
Reference in a new issue