Static Private cacheStatic Private decodedStatic Private pendingStatic Private pendingGet an AudioBuffer for the specified URL, using intelligent caching strategies.
Caching Flow:
The cache prioritizes HTTP conditional requests (ETag/Last-Modified) over TTL to ensure content freshness while maintaining performance through 304 responses.
AudioContext for decoding audio data
URL of the audio resource to fetch
Optional signal: AbortSignalOptional AbortSignal to cancel the operation
Optional callbacks: { Optional onOptional onOptional onOptional onOptional onOptional onOptional onPromise that resolves to decoded AudioBuffer
Error if audio cannot be fetched or decoded
Static Private callStatic Private collectCollects all chunks from a ReadableStream into a single ArrayBuffer
The ReadableStream to collect from
Optional knownLength: numberPromise that resolves to the complete ArrayBuffer
Static Private createCreates a ReadableStream wrapper that tracks download progress Uses the callback aggregation system to emit progress to all registered listeners
The fetch Response object with ReadableStream body
URL being downloaded (for progress event data and callback lookup)
Object containing the progress-tracking stream and total size
Static Private decodeStatic Private fetchOptional etag: stringOptional lastModified: stringOptional signal: AbortSignalOptional callbacks: { Optional onStatic Private getStatic Private getStatic Private getOptional signal: AbortSignalOptional callbacks: { Optional onStatic Private openStatic setStatic Private update
AudioCache provides efficient caching of audio resources using HTTP caching standards.
Features:
Caching Strategy:
Example