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