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 native streaming startup so `spotatui` resolves and activates its local Connect device when Spotify reports no active playback, restores paused native sessions without opening the device selector, preserves saved external device preferences, and renders an actionable idle playbar while playback state catches up. Also prioritizes the initial current-playback fetch ahead of playlist loading. # Testing - `cargo fmt --all` - `cargo clippy --no-default-features --features telemetry -- -D warnings` - `cargo test --no-default-features --features telemetry` - `cargo test native_activation` - `cargo check` # Additional notes Manually tested on macOS and Arch Linux. On macOS, playback state restored after playing through native `spotatui`, pausing, quitting, and reopening the app. On a fresh start on Arch Linux, the same paused playback state was restored as well, making me believe it covers the cross-device/native-session restore path. # P.S. Still was not able to reproduce the issue #301, this should have been addressed by #293 (also given that the reported issue is reported for older release), but put this one in changelog as 301 :)
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.