Action

Type

Resolved On

Cache the listening waveform instead of decoding the whole track on every visitimprovement- - -

Cache the listening waveform instead of decoding the whole track on every visit

project listening.im·type improvement

Every visit to a track downloaded the whole audio file a second time — once for playback, once to decode 8,000 bars out of it. A five minute track is ten megabytes of waste per visit, on a household connection, for a decoration. The fix is the technique taken from the paid CodeCanyon HTML5 Audio Player: a waveform is a CACHEABLE ARTEFACT, not a per-visit computation. Store the peaks in IndexedDB keyed by the track id AND the audio URL (a re-encoded file has a new waveform), and skip the fetch and the decode entirely on a hit. The cache is an optimisation, never a gate — IndexedDB can be missing, blocked or full, so every read answers with a null and every write is a no-op, and a miss falls back to decoding. The record is written only after the load succeeds, so a load that never happened cannot leave a waveform behind. Landed in listening.im as src/player/peak-cache.ts, wired into the WaveSurfer engine.