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
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:
1 parent
d5cf0d8d64
commit
78b815ae8f
14 files changed
+754
-38
No files matched your search
@@ -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
|
||||
|
||||
@@ -83,6 +83,10 @@ rest timer, on purpose — a second floating bar with its own look reads as a se
|
||||
- **pause** — keeps the station, so the same one is still there after the rest
|
||||
- **stop** — takes the bar and the station away
|
||||
|
||||
Tapping the bar itself opens the full player — the logo at size, the station, its genre, what it
|
||||
says it is playing, and pause/stop — with **no scrubber and no clock**, because a live stream has no
|
||||
position and no end, and a slider that does nothing is worse than a sentence that says so.
|
||||
|
||||
**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 —
|
||||
|
||||
Reference in new issue
Block a user