Skip to content

fix(streaming): keep playback on native device, surface failures (#282)#287

Open
LargeModGames wants to merge 1 commit into
mainfrom
fix/issue-282-native-streaming-routing
Open

fix(streaming): keep playback on native device, surface failures (#282)#287
LargeModGames wants to merge 1 commit into
mainfrom
fix/issue-282-native-streaming-routing

Conversation

@LargeModGames
Copy link
Copy Markdown
Owner

Summary

Fixes #282. Native streaming could silently fail and route audio to the official Spotify client (or 404 with NO_ACTIVE_DEVICE) with no feedback to the user.

  • Routing: after selecting the spotatui device, current_playback_context still held the previous device, so is_native_streaming_active_for_playback returned false and start_playback fell through to the deviceless me/player/play (which Spotify routes to whatever device is active). Now clears the stale context on native selection (mirrors the non-native transfer branch) and adds a short last_device_activation grace window to the routing gate, so the first play stays on the chosen native device. Safe vs Spotatui "hijacking" Spotify playback device from Android. #254 — the poll re-derives is_streaming_active each cycle and the recovery handler is untouched.
  • Notification: handle_player_events dropped PlayerEvent::Unavailable into the catch-all arm, so audio-key failures were completely silent. Now handled with a consecutive-failure counter (reset on Playing) that shows a status message, escalating after 3 consecutive failures.
  • Docs: README note about the upstream error audio key 0 1 limitation.

Testing

  • cargo fmt --all -- --check — clean
  • cargo clippy -- -D warnings — clean
  • cargo clippy --no-default-features --features telemetry -- -D warnings — clean
  • cargo test — 239 passed; 0 failed
  • cargo test --no-default-features --features telemetry — 226 passed; 0 failed

Additional notes

  • The error audio key 0 1 decryption block itself is an upstream Spotify change (correlated with account age — newer accounts fail, pre-2020 typically work) that affects all librespot-based clients (vanilla librespot #1649, spotify-player #910, go-librespot) and cannot be fixed in-app; librespot v0.8.0 is already the latest. This PR makes the failure visible and keeps playback on the device the user chose — it does not (and can't) restore audio for blocked accounts.
  • Manual check (on an unaffected account): with the official Spotify app open, press d, select spotatui, and play — playback stays local instead of leaking to the official client.
  • Possible follow-up: the NativePlaybackRoute::ContextApi path still targets me/player/play?device_id=… once native_device_id is known; out of scope here.

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.

Native Audio 'spotatui'

1 participant