Keeps stream items' signed URLs fresh. PlayerProvider calls it when a stream fails or a restored session's stream is stale, without knowing which service the stream comes from.
f
isStreamStale(item: Extract<PlayerItem, { kind: "stream"; }>): boolean
Checks whether the signed URL of item is older than STREAM_STALE_MS. PlayerProvider refreshes a restored session's stream when
it is, so that the first press of play doesn't stall.
f
resolveStreamQueue(item: Extract<PlayerItem, { kind: "stream"; }>): Promise<PlayerItem[]>
Re-resolves the whole queue that stream item came from, bypassing the
server's cache. The promise rejects when the stream's type has no resolver
here, or when its resolver fails.
v
STREAM_STALE_MS: number
How old a stream's signed URL may get before isStreamStale says so. Bandcamp's live about 24 hours, and this leaves room for a long listen.
Usage
import * as mod from "src/utils/player/streamSources.ts";