Files
Android-247-Radio/chat-summaries/2026-03-09_bugfix-and-seek-to-live.md
cottongin 49bbb54bb9 fix: star visibility, station switching, skip-ahead, and latency optimizations
- Star icons now use distinct tint colors (primary vs faded) for clear state
- Station switching no longer races — old playback job is cancelled before new
- Skip-ahead drops ~1s of buffered audio per tap via atomic counter
- Custom SocketFactory with SO_RCVBUF=16KB and TCP_NODELAY for minimal TCP buffering
- Catch-up drain: discards pre-buffered frames until network reads block (live edge)
- AudioTrack PERFORMANCE_MODE_LOW_LATENCY for smallest hardware buffer

Made-with: Cursor
2026-03-10 04:41:40 -04:00

1.8 KiB

Bugfix: Star icons, station switching, and seek-to-live

Date: 2026-03-09

Task description

Fixed three issues found during manual testing of the app.

Changes made

1. Star icon visual state (StationListScreen.kt)

  • Added explicit tint colors to star icons: primary color when starred, faded onSurfaceVariant (40% alpha) when unstarred.
  • Applies to both station rows and playlist section headers.

2. Station switching race condition (RadioPlaybackService.kt)

  • Added playJob tracking — each new play request cancels the previous playback coroutine before starting a new one.
  • The old job's finally block now checks playJob == coroutineContext[Job] to avoid calling cleanup()/stopSelf() when being replaced by a new station.
  • Tapping the same station now restarts it (re-fires ACTION_PLAY).
  • Fixed collector coroutine leak: return@collect on terminal events (Error, Stopped) so the SharedFlow collection terminates.

3. Seek-to-live feature

  • Added ACTION_SEEK_LIVE to RadioPlaybackService — ends current connection span, stops/restarts the engine for the current station without creating a new ListeningSession.
  • Added seekToLive() to RadioController.
  • Added seekToLive() to NowPlayingViewModel.
  • Added "SKIP TO LIVE" FilledTonalButton to NowPlayingScreen, positioned between latency indicator and Stay Connected toggle. Disabled during reconnection.

Files changed

  • app/src/main/java/.../ui/screens/stationlist/StationListScreen.kt
  • app/src/main/java/.../service/RadioPlaybackService.kt
  • app/src/main/java/.../service/RadioController.kt
  • app/src/main/java/.../ui/screens/nowplaying/NowPlayingScreen.kt
  • app/src/main/java/.../ui/screens/nowplaying/NowPlayingViewModel.kt

Follow-up items

  • None identified.