fix spotatui native device and selector behavior#293
Conversation
|
Nice fix, this addresses the root cause well. The native-activation gate ( Two small things:
Otherwise looks good to merge. |
7828e31 to
f704140
Compare
|
Thanks @LargeModGames, good catch. I removed the unreachable the non-native transfer branch is already symmetric: when the Web API transfer succeeds, it persists the selected |
f704140 to
782366c
Compare
782366c to
638211e
Compare
|
Found one more related long-idle case and pushed a fix for it. After leaving The new change treats stored native players as active only when connected, clears stale native state when detected, and triggers the existing native streaming recovery flow from playback/device selection instead of falling through to Web API playback. |
# Summary Fixes a native streaming recovery edge case where spotatui could keep treating a stale Spotify API `spotatui` device snapshot as the active native player after librespot disconnected and recovered. This edge-case became more plausible with the changes added in scope of #293 This change makes name-only native device matches valid only when there is fresh local native activity, native playback metadata, or a very recent explicit activation. It also clears stale playback context on native disconnect so old API state cannot keep re-poisoning playback routing. # Testing - `cargo fmt --all -- --check` - Passed - `cargo clippy --no-default-features --features telemetry -- -D warnings` - Passed - `cargo test --no-default-features --features telemetry` - Passed: 235 tests - `cargo check` - Passed with default features, including native streaming code
Summary
Fixes #292
This change makes explicit playback use the connected native
spotatuistreaming player when there is no current Spotify playback context, instead of falling through to the Web API and failing withNO_ACTIVE_DEVICE.It also fixes the device selector behavior:
spotatuidevice to the selector when Spotify's devices API omits it.Enterdispatch device transfer and close the selector.Escclose the selector instead of trapping the user.Testing
cargo fmt --allcargo clippy --no-default-features --features telemetry -- -D warningscargo test --no-default-features --features telemetrycargo checkAdditional notes
The original bug showed as a Spotify API
404 Not Found/NO_ACTIVE_DEVICEerror when trying to play tracks, while the localspotatuiplayback device was missing from the device selector. The selector could also become stuck becauseEscwas swallowed by the global handler.