Skip to content

Fix sleep timer#482

Merged
samfundev merged 1 commit intotwireapp:masterfrom
Wingo206:fix-sleep-timer
Feb 6, 2026
Merged

Fix sleep timer#482
samfundev merged 1 commit intotwireapp:masterfrom
Wingo206:fix-sleep-timer

Conversation

@Wingo206
Copy link
Contributor

Fixes #454, there were two separate aspects:

  1. stopAudioOnly() would release and initialize the player asynchronously, so player was null immediately after.

  2. 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.

@samfundev
Copy link
Collaborator

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.

@Wingo206
Copy link
Contributor Author

Wingo206 commented Feb 1, 2026

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?

@samfundev
Copy link
Collaborator

Yeah, you can do that. I'll merge this in and feel free to create a follow up PR.

@samfundev samfundev merged commit 974a68e into twireapp:master Feb 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sleep timer doesn't seem to work anymore

2 participants