audio
backend.api.audio
Section titled “backend.api.audio”audio streaming endpoint.
Functions
Section titled “Functions”stream_audio source
Section titled “stream_audio source”stream_audio(file_id: str, request: Request, session: Session | None = Depends(get_optional_session))stream audio file by redirecting to R2 CDN URL.
for public tracks: redirects to R2 CDN URL. for gated tracks: validates supporter status and returns presigned URL.
HEAD requests are used for pre-flight auth checks - they return 200/401/402 status without redirecting to avoid CORS issues.
images are served directly via R2 URLs stored in the image_url field, not through this endpoint.
get_audio_url source
Section titled “get_audio_url source”get_audio_url(file_id: str, session: Session | None = Depends(get_optional_session)) -> AudioUrlResponsereturn direct URL for audio file.
for public tracks: returns R2 CDN URL for offline caching. for gated tracks: returns presigned URL after supporter validation.
used for offline mode - frontend fetches and caches locally.
Classes
Section titled “Classes”AudioUrlResponse source
Section titled “AudioUrlResponse source”response containing direct R2 URL for offline caching.