tasker: fix player main thread bugs on restore
This commit is contained in:
@@ -164,17 +164,17 @@ class ExoPlaybackStateHolder(
|
|||||||
logD("Restoring playback state")
|
logD("Restoring playback state")
|
||||||
restoreScope.launch {
|
restoreScope.launch {
|
||||||
val state = persistenceRepository.readState()
|
val state = persistenceRepository.readState()
|
||||||
if (state != null) {
|
withContext(Dispatchers.Main) {
|
||||||
// Apply the saved state on the main thread to prevent code expecting
|
if (state != null) {
|
||||||
// state updates on the main thread from crashing.
|
// Apply the saved state on the main thread to prevent code expecting
|
||||||
withContext(Dispatchers.Main) {
|
// state updates on the main thread from crashing.
|
||||||
playbackManager.applySavedState(state, false)
|
playbackManager.applySavedState(state, false)
|
||||||
if (action.play) {
|
if (action.play) {
|
||||||
playbackManager.playing(true)
|
playbackManager.playing(true)
|
||||||
}
|
}
|
||||||
|
} else if (action.fallback != null) {
|
||||||
|
playbackManager.playDeferred(action.fallback)
|
||||||
}
|
}
|
||||||
} else if (action.fallback != null) {
|
|
||||||
playbackManager.playDeferred(action.fallback)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user