dev → main: Android UPnP/Sonos transport parity + server stream URL extension #79

Merged
bvandeusen merged 69 commits from dev into main 2026-06-04 08:15:15 -04:00
2 changed files with 13 additions and 1 deletions
Showing only changes of commit 85926f4ec0 - Show all commits
@@ -218,6 +218,14 @@ class MinstrelForwardingPlayer(
override fun getPlaybackState(): Int =
if (isRemote()) Player.STATE_READY else super.getPlaybackState()
// Mirror remote state so any consumer that gates on playWhenReady --
// notably MediaSessionService's foreground-keepalive checks and our own
// onTaskRemoved -- sees the remote renderer as the source of truth.
// Without this, swiping the app away with Sonos playing would stop the
// service, kill the poll loop, and leave Sonos orphaned.
override fun getPlayWhenReady(): Boolean =
if (isRemote()) remoteState.isPlaying else super.getPlayWhenReady()
override fun release() {
pollJob?.cancel()
scope.cancel()
@@ -176,7 +176,11 @@ class MinstrelPlayerService : MediaSessionService() {
override fun onTaskRemoved(rootIntent: Intent?) {
val player = mediaSession?.player ?: return super.onTaskRemoved(rootIntent)
val activelyPlaying = player.playWhenReady && player.playbackState != Player.STATE_ENDED
// player.isPlaying is overridden on MinstrelForwardingPlayer to return
// remoteState.isPlaying while UPnP is active, so a swipe-away with
// Sonos playing keeps the service (and its UPnP poll loop) alive.
val activelyPlaying = player.isPlaying ||
(player.playWhenReady && player.playbackState != Player.STATE_ENDED)
if (!activelyPlaying) {
stopSelf()
}