Música tiene una sección **Podcasts**: programas por categoría —Salud y fitness, Deporte, Comedia, Noticias, Historia, Crímenes reales, Ciencia, Tecnología, Sociedad y cultura, Negocios, Ficción, Educación, Música, Ocio— que suenan mientras entrenás y siguen donde los dejaste. Sin dependencias nuevas y sin clave de API: el directorio de Apple es público. **En español se comprueba, no se supone.** La tienda dice dónde se *vende* un podcast, no en qué idioma está —en el ranking español de comedia hay uno en catalán y en el argentino uno en inglés—, así que se lee el `<language>` del feed de cada programa (los primeros 64 KB, con una petición `Range`: el idioma está en las primeras líneas) y se descarta lo que no sea español. Un feed sin etiqueta se queda: feeds genuinamente españoles la omiten, y tirarlos por una omisión sería sacar podcasts buenos de la lista. La respuesta cuenta cuántos quedaron afuera y por qué (`skipped`), así que una lista corta nunca es un misterio, y abrir un programa en otro idioma se contesta con `spanish:false` en vez de con una lista vacía. Es la otra mitad de la radio y es lo contrario en todo lo que le importa al reproductor: un podcast es un **archivo** —tiene principio, final y un minuto en el que ibas—. Por eso hay un módulo de reglas puras (`lib/podcast-view.js`: dónde retomar, qué cuenta como escuchado, cuál sigue, cuántas posiciones se guardan) y por eso `lib/radio-player.js` pasa a ser `lib/player.js`: **un solo elemento de audio** para las dos cosas, que es lo que impide que una emisora y un episodio suenen a la vez. La barra crece línea de progreso, −15 s, +30 s, siguiente episodio y reloj; la posición se guarda por perfil (con tope de 200, lo más nuevo primero) en pausa, al parar, al terminar y cuando la app se va al fondo, porque con la pantalla bloqueada iOS suspende los temporizadores y un guardado sólo desde el tick perdería lo escuchado con el teléfono guardado. Media Session muestra episodio, programa y progreso en la pantalla bloqueada. Nada se descarga y nada pasa por el servidor: el episodio llega como la URL del `enclosure` y el audio va de quien lo publica al teléfono. Acá no hay lista blanca posible —un feed vive en cualquier host—, así que la puerta es **https, host real y nunca una dirección privada**, comprobada en la URL y en dónde terminó el pedido, con el cuerpo leído a tope y la conexión cortada al llegar: este contenedor vive adentro de una casa. Verificado con datos reales: 20 programas en español por categoría (idiomas es, es-ES, es-mx), un feed de 40 episodios parseado, un feed en inglés contestado como `spanish:false` y la dirección de metadatos rechazada con 400 sin hacer el pedido. Fuera de los podcasts: la página de la API ocultaba `health` y `music` enteras —el generador sólo dibuja las secciones de su tabla de etiquetas—, así que ahora están, con radio y podcasts incluidas.
7.8 KiB
Radio
Live stations, for the hour you're in the gym. Open Música → Radio, pick a genre, press a station, and it plays while you train — across screens, with the screen locked and the phone in your pocket.
It is radio, not a music library: you don't pick the song, and nobody has to. That is the whole reason it exists next to the Apple Music playlists on the same screen — one is what you listen to on purpose, the other is what plays while you count reps.
What is playing
Chips pick a genre. Ten of them: Workout / Rave, Techno / House, R&B / Soul, Latina, Hip-Hop, Reggae, Chill, Jazz, Rock, Electrónica. Each one is a list of SomaFM channels (curated by hand — a machine cannot know that Seven Inch Soul is the R&B one), the Radio Paradise mixes that fit, and the radio-browser tags that fill in the rest.
The ad-free ones come first in every genre: SomaFM is a listener-supported, commercial-free network
of 46 channels, and Radio Paradise is four hand-mixed ones. Both publish their stream as a playlist
.pls, which api/radio.js reads rather than guessing a bitrate into a URL — that is what makes the
same code work for every channel, including the ones added after this was written.
Behind them is radio-browser, a public, community-run directory of
tens of thousands of stations. It is filtered hard: HTTPS only (a page served over HTTPS cannot
play an http:// stream at all — the browser blocks it as mixed content, so offering one would be
offering a station that silently does nothing), hidebroken=true, ordered by how many people
actually listen to it.
Where the audio goes
From the station to your phone. Never through this server.
The api hands out the list — each station with its stream URL already resolved — and after that it sees nothing: no traffic, no disk, no byte of audio. On a small VPS that is the difference between a feature and a bandwidth bill, and it is also why nothing here ever downloads, records or keeps a copy of anything.
Two kinds of request do reach out from the server, and both are for the list and its caption:
| Call | To | Why |
|---|---|---|
channel list + .pls |
somafm.com | to resolve a channel into a stream URL |
bytagexact search |
all.api.radio-browser.info | the directory's stations per genre |
now_playing |
api.radioparadise.com | the cover and the track for the bar |
All of them are cached for ten minutes, so opening the screen twice is one round of requests. Every
outgoing call goes through one function with a host allowlist (RADIO_HOSTS) — the api container
sits on the owner's own network, so the set of hosts it will talk to is a security boundary, not a
convenience.
So the server does see something: which genre chip was pressed, and — only for the two sources that publish what they play — which station the bar is asking about, once every 45 seconds while it plays. Nothing is written down: those are requests, not records, and there is no table, log or file where listening would accumulate. (The request log in the admin dashboard is the activity log, and it carries sign-ins and admin actions, not this.)
Why the stream URL arrives in the list
iOS only lets audio start inside the gesture that asked for it. Anything asynchronous between the
finger and the play() — a fetch, a state update, a re-render — is a press that does nothing, with
no error anywhere. So the list arrives complete: by the time a station has been drawn on the screen,
its stream URL is already in the object the row holds, and the press calls play() synchronously.
The <audio> element lives in frontend/src/lib/player.js, outside React, as a module-level
singleton — the same element the podcasts use, which is also what keeps a station and an episode from
ever playing at once. An element owned by a component is unmounted when the component is, which is
how a player stops the moment you change screens — and changing screens mid-session is the normal
case here, not the edge case.
The bar, and the lock screen
While something is playing, a bar sits above the tab bar (the same place and the same glass as the rest timer, on purpose — a second floating bar with its own look reads as a second app):
- the station, and what it says it is playing
- pause — keeps the station, so the same one is still there after the rest
- stop — takes the bar and the station away
Media Session is what puts the station, the track and the controls on the lock screen and in the car, and it is what makes "screen off, phone in pocket" work: the audio is played by the browser underneath the page, not by the page's timers. Those timers — the 45-second poll for what is playing — are suspended while the screen is locked, so the caption simply stops moving until you look again. It is a caption; the music is unaffected.
On the native Android/iOS shells the same rules apply, with one addition: keeping audio alive
under a locked screen in a WebView needs UIBackgroundModes: audio (iOS) and a foreground service
(Android) in the shell's own config. Neither is set today — that is described in
docs/MOBILE.md, and it only affects the packaged builds, not the PWA.
When the radio isn't there
Two situations look like a bug and are not, so the screen says which one it is instead of showing a request that failed:
- Nobody is signed in. Guest mode is client-side only and never talks to the api, and the station list is the server's job — so the section says the radio needs a profile. No request is made.
- The api is older than the app. They ship separately:
webis rebuilt from source on every deploy, while the api's code lives inside its container, so a deploy can leave a new screen on top of an api that has never heard of/api/radio.GET /api/configlists what that api can do (features, and this build answersradio), so "old server" is detectable — the section says so, quietly, rather than offering chips that 404. The same list is what keeps the Salud screen from blaming the data when it is really the container.
Saving a station
The star on a row saves the station to your profile (music.stations), and saved ones are pinned
above the list. They are stored with the rest of your profile's client state — they contain nothing
about your listening, just the station you liked.
What this deliberately is not
- Not a YouTube/Spotify front end. Ripping streams or playing someone else's catalogue through an unofficial API breaks those services' terms and this project's licence is AGPL; the honest version of "radio" is radio.
- Not a proxy. No endpoint here relays audio. Every
/api/radioresponse is JSON, and the routes are session-gated so the list cannot be borrowed by somebody else's page. - Not a downloader. There is no record button and no cache of audio anywhere.
- Not HLS. Stations that only stream HLS are skipped: playing them in a browser needs
hls.js, and a dependency-light project does not take a media stack on for a feature whose whole point is that it makes no new dependency necessary.
Credits and licences
- SomaFM — listener-supported, commercial-free; the channels used here are
theirs, and their stream URLs are resolved through their own public
.pls. - Radio Paradise — listener-supported, and the
now_playingendpoint that gives the bar its cover art. - radio-browser — the directory itself is AGPL-3.0, same family as this project, and it is the reason the long tail of stations is reachable at all.
These are third-party services this app does not control: a station that goes off the air disappears from the list on the next refresh, and a genre that comes back thin is the directory having a bad day, not the app.