Loads an audio file's waveform for Scrubber, by way of usePeaks: an
uploaded file's from the server, which made it once with ffmpeg, and a
file not yet uploaded (the dump form's preview) by decoding it here.
f
loadPeaks(source: PeaksSource): Promise<number[]>
Returns the peaks of source, from 0 to 1.
f
peaksKey(source: PeaksSource): string
Returns the key loads keeps source's peaks under.
T
PeaksSource = { peaksUrl: string; } | { localFile: string; }
Where a waveform's peaks come from: the server's for an uploaded file
(dumpWaveformUrl), or the bytes of a local file, by its blob: URL.
Usage
import * as mod from "src/utils/player/waveform.ts";