Streaming public-domain music from the Internet Archive
internet-archivepublic-domainstreamingcorsmusic-app
archive.org can serve as the entire media backend for a music player: it has search,
per-item file listings, and direct downloads that support CORS and HTTP Range, so a web
or mobile app can stream and seek without hosting any audio itself. This matters when the
only server available is too small to store or transcode media (as with the 1 GB Nanode).
The patterns below were tested empirically in July 2026 while building the GPM-style
music player in ~/dev/music.
API patterns that work
- Search:
https://archive.org/advancedsearch.php?q=<lucene query> AND mediatype:audio&fl[]=identifier&rows=N&output=json. Responses can take around 5 seconds, so do not block playback on a full result set. - Bulk listing: the scrape API
https://archive.org/services/search/v1/scrapepages through large result sets with a cursor and is the right tool for harvesting. - Files in an item:
GET https://archive.org/metadata/{identifier}. GET only; HEAD returns 405. Filter thefilesarray onformat == "VBR MP3"to get the streamable derivatives. - Stream URL:
https://archive.org/download/{identifier}/{urlencoded file name}. It 302-redirects to a datanode; every hop sendsAccess-Control-Allow-Origin: *and honorsRange, so seeking works in a browser<audio>element. - Cover art:
https://archive.org/services/img/{identifier}has no CORS headers. A plain<img>works, but canvas-based renderers (Flutter web's CanvasKit) fail. In Flutter useImage.network(..., webHtmlElementStrategy: WebHtmlElementStrategy.fallback)so it falls back to an HTML<img>element.
Collections worth knowing
| Collection | What it is | License notes |
|---|---|---|
georgeblood |
~187k digitized 78 rpm sides | Mostly pre-1926 is safely public domain; audio is crackly |
unlockedrecordings |
Out-of-print commercial recordings | Noncommercial only, not public domain |
netlabels |
Netlabel releases | Creative Commons, check each item |
musopen |
~34 classical items | CC0 |
identifier:OpenWell-TemperedClavier_Book_I |
Well-Tempered Clavier, Book I | Open recording |
US public domain for sound recordings: under the Music Modernization Act, recordings made before 1926 are public domain in the US as of 2026, and the cutoff advances by one year every January 1. Composition copyright and recording copyright are separate; a public-domain composition in a modern recording is still a copyrighted recording.
Player design lessons
- Fast start: resolve only the first ~4 items of a query, start playing, then fill the queue in the background. Guard background work with a generation counter so a new request aborts stale fills.
- Stations without ML: a "station" can just be a saved Lucene query (mood, genre, era, collection), optionally limited to dayparts by hour.
- Back off on errors: auto-skipping failed tracks without a delay produced a burst of requests and a 429 storm. Add exponential backoff to error-skip.
- Claim the play intent before network I/O: otherwise two quick taps race and the slower response wins.
- Count a play only after ~8 seconds of actual listening.
- Cache station art so launch does not fire one request per station.
- Vintage 78s are a niche taste; flag them and keep featured content to the cleaner collections.
Personal uploads alongside IA
For a user's own music, a small PHP endpoint can relay Range requests from a private
object storage bucket (206 responses verified). Because just_audio on web cannot add
request headers, auth has to ride in a query parameter (?t=<token>); keep the token in
server-side config, not in the repo. See Linode (Akamai) Object Storage for the bucket-scoped
key gotcha hit on that build.
See also
- just_audio in Flutter, gotchas and patterns
- Linode (Akamai) Object Storage
- Flutter web (renderers, SEO, performance, when not to use it)