playback: fix improper re-initializaiton

Fix issues stemming from how ExoPlayer apparently doesn't send a
playWhenReady event after being stopped.

This ended up breaking AudioEffect integration and notification
posting. I really don't know why player.stop() doesn't do this.
This commit is contained in:
Alexander Capehart
2023-06-02 14:47:14 -06:00
parent e39d4d879c
commit e150647573
2 changed files with 5 additions and 2 deletions
@@ -226,8 +226,11 @@ class PlaybackService :
if (song == null) {
// No song, stop playback and foreground state.
logD("Nothing playing, stopping playback")
// For some reason the player does not mark playWhenReady as false when stopped,
// which then completely breaks any re-initialization if playback starts again.
// So we manually set it to false here.
player.playWhenReady = false
player.stop()
stopAndSave()
return
}