Spotify: end the session for OTA; app volume starts at the player's

- OTA: the player now ends the Spotify session (spotify_suspend: stop
  flag, waits until the session's tasks are gone, refuses new ones)
  instead of pausing it, and suspends HLS. Pausing was not enough (an
  upload still failed once with a paused session). Verified twice with a
  session running for minutes: "Disconnecting mercury session / session
  ended / suspended", installed in ~26 s, clean reboot.
- Volume: createFromBlob() starts cspot at volume 0, which the app
  showed while we played at 100 %. The session now starts with the
  player's volume (spotify_set_volume); volumes coming from the app are
  stored exactly, without echo. Verified: slider starts at 100 %.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 20:15:29 +10:00
parent 0aac7bc339
commit f0fe53d5d1
3 changed files with 51 additions and 9 deletions
+6
View File
@@ -30,6 +30,12 @@ esp_err_t spotify_init(spotify_pcm_cb_t pcm, spotify_event_cb_t event);
void spotify_apply(void);
// Pause/resume the running session (the Spotify app follows). No-op without a session.
void spotify_pause(bool pause);
// Suspend: end any running session (waits until its tasks are gone, max ~3 s) and refuse new ones.
// Resume: back to what the config says. Used around firmware uploads.
void spotify_suspend(bool suspend);
// The player's volume (0..100 %): reported to the Spotify app when a session starts (else the app
// shows 0 while we play at the player's level), and pushed to a running session.
void spotify_set_volume(int pct);
// Current state for status.spotify_state.
const char *spotify_state(void);