Action | Type | Resolved On |
|---|---|---|
| Remember where the listener stopped, and forget a finished track | feature | - - - |
project bearlabs·type feature
The shared listening playlist remembered nothing: a page reload put the track back at the top, in both sites that mount it (benben.im and hygge.im). The technique is taken from the paid CodeCanyon HTML5 Audio Player and StreamLab: keep the position in the browser as {time, duration, updated} per track, write it every ten seconds while playing, on pause, and when the page goes away (pagehide / visibilitychange) — the moment the position is most worth having. Two rules travel with the technique and both matter: a track that reached 95% is FORGOTTEN rather than saved at 100%, because a finished track starts from the top next time; and the store is bounded at 200 entries, newest first, because a store that grows without limit eventually throws in the middle of a timeupdate. One trap: the load() that a track switch triggers fires pause BEFORE the new source has reset currentTime, so the loaded id is tracked separately from the selected one. Landed in the shared module as components/listening/lib/progress.ts, wired into playlist.tsx with a small badge that forgets the position and starts over.