You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add session recovery with automatic playback resume
When the TCP connection to Spotify access points drops due to network
instability, the keep-alive timeout fires after ~80s and invalidates
the session. The old spirc shuts down and a new Session + Spirc is
created. However, three things went wrong:
1. Session ID mismatch: The new Session generated a fresh random UUID,
so Spotify could not match it to the previous playback session. The
automatic transfer in handle_connection_id_update failed because
the cluster session_id did not match the new session_id.
2. Volume reset: ConnectConfig.initial_volume was set once at startup
and reused on every reconnection. The new SpircTask initialized the
mixer to this stale value instead of the users current volume,
causing a jarring volume jump on reconnect.
3. Playback not resuming: The transfer state from Spotify always has
is_paused=true after a disconnect, since the device went offline.
handle_transfer used this to set start_playing=false, so the track
loaded paused even though the user was actively listening.
Fixes:
- Preserve session_id across reconnections for automatic transfer
- Preserve mixer volume on reconnect, only override after first connect
- Track user play intent via shared Arc<AtomicBool> was_playing flag
- Add force_play parameter to handle_transfer for reconnection resume
- Add shutdown reason strings to session.shutdown for debugging
- Fast-fail audio key requests when session is invalid
- Use RwLock<Session> in player for session hot-swap
0 commit comments