playback: a cached track plays without asking Soulseek where it lives

Hopping between songs of an already-cached album still ran the full
"finding best source…" resolve for audio sitting complete on disk — a
second of popup between every click. The player now remembers the source
each stream item was queued from (localStorage, LRU-capped at 400) and,
before any search, asks the backend whether that exact file is
byte-complete in the stream cache. If it is, the track plays those bytes
immediately: no resolver, no popup, and no online requirement — cached
audio is playable offline, so the check sits before requireOnline.

The memory is a hint, never a promise. It is written eagerly when an item
is queued to PLAY, because a source that never delivers leaves no complete
cache file and the byte-complete probe rejects it later at no cost;
eviction and half-finished transfers fall back to the normal resolver the
same way. First play of a track records it, every play after that is
instant.
This commit is contained in:
KeelrLeek committed 2026-08-03 16:08:51 -05:00
1 parent b33d403634
commit f55562f0ab
4 files changed
+138

No files matched your search

+2
View File
@@ -182,6 +182,8 @@ export const preloadCachedStream = (username, path, size, duration) =>
invoke("preload_cached_stream", { username, path, size, duration });
export const streamWaveform = (username, path, size, buckets) =>
invoke("stream_waveform", { username, path, size, buckets });
export const streamCacheReady = (username, path, size) =>
invoke("stream_cache_ready", { username, path, size });
// Preview tracks (scrollable-track-previews): a fully separate audio path.
// previewResolve returns { ok, lease | failure, retryable } — the signed URL