Commit Graph

1 Commits

Author SHA1 Message Date
Glenn Thompson 10c75f04e1 Stream sync, countdown timer, playback state fix, buffer bloat detection
Multi-pronged attempt to fix cumulative lag between audio playback,
now-playing display, and browser notifications:

== Synchronization (work in progress) ==
- Server-side time-based metadata delay via get-listener-now-playing
  with configurable *browser-buffer-seconds* parameter
- First track after restart syncs perfectly; subsequent tracks drift
  due to browser audio buffer bloat (buffer grows unbounded over time)
- Added client-side buffer bloat detection: monitors audio.buffered
  vs audio.currentTime and auto-reconnects when buffer exceeds 15s
- Added [STREAM-SYNC], [NOTIFY], [BUFFER] diagnostic logging to
  browser console for ongoing diagnosis

== Countdown timer ==
- Server exposes remaining seconds via pipeline-track-remaining
- now-playing JSON API includes 'remaining' field adjusted for
  browser buffer delay
- Player frame shows [mm:ss] countdown next to track title
- Main page now-playing area also shows countdown with its own
  polling (15s interval) and local 1-second ticker
- LASS styles for .track-countdown and .track-countdown-mini

== Playback state fix ==
- Fixed save-playback-state saving one track ahead of what was
  actually playing (was saving the track loading during crossfade)
- Uses *pending-save-file* with one-track delay so the saved state
  reflects the track that was actually heard

== Notifications ==
- All notification conditions working correctly per diagnostic logs
- show-track-notification logs supported/permission/enabled/last/title
- Notifications fire consistently on track changes
2026-04-09 16:32:58 +01:00