Conversation
|
Thanks for working on this! These changes look great, I'd be okay with accepting this as is. But if you're interested in doing some refactoring, that would be great as well. It seems like it should be possible to add a custom command to control the sleep timer and then have the media session expose the time remaining in the session extras which can be listened to by the player. If you have a better way of handling things, feel free to do that instead. SleepTimer could also use CountDownTimer to simplify the code even further, but that's not the main priority. |
|
For now I think this fix would be great to get in, if I do some refactoring could I do that as a follow up PR? |
|
Yeah, you can do that. I'll merge this in and feel free to create a follow up PR. |
Fixes #454, there were two separate aspects:
stopAudioOnly() would release and initialize the player asynchronously, so player was null immediately after.
For when the app is minimized, player is null in the StreamFragment, so I made it re-get the PlaybackService to pause it.
For now I just wanted to submit this fix and not change too much. This approach for the second thing felt pretty hacky though, so I considered doing a larger refactor since the underlying problem is that the SleepTimer is stored in the UI, but I figured I should ask the maintainers before doing that.