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:45:25 -06:00
parent e39d4d879c
commit e150647573
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 5 additions and 2 deletions

View file

@ -22,7 +22,7 @@ within it
- Fixed freezing occuring when scrolling through large music libraries
- Fixed app not responding once music loading completes for large libraries
- Fixed crash when the last song of the queue gets removed while playing
- Fixed playback UI not re-appearing after playback ends
- Fixed playback UI and notification not re-appearing after playback ends
#### What's Changed
- Android Lollipop and Marshmallow support have been dropped

View file

@ -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
}