El reproductor completo al tocar la barra, y el episodio siguiente al terminar
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s

Tocar la barra abre el reproductor completo, como el de Spotify: portada en grande,
título entero, programa, autor, número de episodio y fecha, una barra que se arrastra,
el tiempo transcurrido y **lo que falta**, −15/+30, anterior y siguiente, y una línea
que dice **"Después: …"** con el nombre del que sigue —o que es el último de la lista.
Es una hoja, no una ruta, por lo mismo de siempre: una pantalla dentro del router se
desmonta al navegar y esto no puede ser lo que corte el audio. Para una emisora el
mismo reproductor no dibuja barra de progreso: una radio en vivo no tiene posición ni
final, y decirlo es mejor que un slider muerto.

Un episodio que termina **sigue con el siguiente** de la lista en la que lo pusiste a
sonar, sin tocar el teléfono; al final de la lista se detiene y el reproductor lo
avisa antes. El que termina queda marcado como escuchado. Los botones de siguiente y
anterior de la **pantalla bloqueada** ahora llegan al elemento de audio, que es donde
alguien con las manos en la barra los va a apretar.

Y dos cosas que aparecieron revisando esto:

- `setRadioNow` llamaba a `setMediaSession`, una función que ya no existe desde que el
  reproductor se unificó (hoy `setStreamSession`). El error quedaba **tragado** por el
  `.catch` del sondeo: la pantalla mostraba el tema —el estado se actualiza antes de la
  línea que falla— y la **pantalla bloqueada nunca se enteraba** del tema que sonaba.
  Ahora hay un test que lo mira y se comprobó por mutación.
- `useUI` tenía **dos definiciones** de `setRadioVolume` y `setRadioNow`: al insertar el
  bloque de podcasts había quedado duplicado el final del bloque de radio, y en un
  objeto literal la última gana en silencio. Una copia era código muerto que se leía
  como vivo — y fue la que hizo que el primer intento de comprobar lo anterior "pasara".

Tests nuevos: useUI.podcast.test.js (16, con el reproductor burlado emitiendo lo que
emite un navegador: ended → siguiente, time → reloj, paused → posición guardada),
NowPlaying.test.jsx (13) y el toque en la barra en PlayerBar.test.jsx.
This commit is contained in:
dsantillan committed 2026-09-23 21:40:17 -04:00
1 parent d5cf0d8d64
commit 78b815ae8f
14 files changed
+754 -38

No files matched your search

+24
View File
@@ -78,6 +78,30 @@ sitting inside somebody's house:
- Both routes need a session — not to protect public podcasts, but because this process fetches on
behalf of whoever asks.
## The full player
Tap the bar — the cover and the text, not the buttons — and it opens the full player, the way tapping
Spotify's bar does: artwork at size, the whole episode title, the show, the author, the episode number
and date, a **scrubber you can drag**, elapsed and **remaining**, −15 / +30, previous and next, and a
line that names **what plays next** ("Then: …") or says that this is the last one in the list.
It opens as a **sheet**, not a route, for the same reason the bar lives above the router: a screen
inside the router is unmounted by navigating, and this must never be the thing that stops the audio.
Swipe down (or Android back) closes it and playback continues.
A station gets the same sheet without the scrubber: a live stream has no position and no end, and
saying so is better than a slider that does nothing.
## When an episode ends
The next one in the list you tapped from plays, with nobody touching the phone. "Next" is literally
the next row of that list — the order you can see — and at the end of it playback stops, which the
full player says *before* it happens. The finished episode is marked heard first, so what you have
listened to stays that way.
The lock screen's next/previous buttons do the same thing, which is the point: that is where somebody
with their hands on a bar is going to press it.
## The player, and the two things that are easy to get wrong
- **Audio only starts inside the tap.** iOS allows audio to begin from a user gesture and from