Add a stop button to the player and resume after a server outage

The full player had no way to stop: Back only moved playback to the
miniplayer. A stop button now sits with the right-hand controls and
closes the player outright, as the miniplayer's close button does.

When the server went away mid-stream, mpv played out its buffer and then
took the cut-off stream for the end of the file: the title counted as
ended (opening Up Next for episodes), and Play restarted it from 0. A
stream ending more than 15 s before its duration is now treated as a
lost connection: the player shows "Lost connection to <server>", checks
/identity every few seconds, and reloads in place at the same position
(staying in the miniplayer) once the server answers; Play tries at once.
A second cut-off at the same spot counts as the real end of the file.

A file left paused at its end (keep-open) re-paused as soon as it was
unpaused, so the reload is unpaused again after loadfile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-17 10:41:52 -07:00
parent 6775d29249
commit 624f01f745
5 changed files with 152 additions and 12 deletions

View file

@ -30,6 +30,7 @@ interface PlayerView {
duration: number;
firstFrame: boolean;
buffering: boolean;
reconnecting: boolean;
error: string;
}
@ -50,7 +51,8 @@ function view(st: PlayerView): MiniState {
position: st.position,
duration: st.duration,
loading: !st.firstFrame && !st.error,
buffering: st.buffering,
// Waiting for the server to come back shows as buffering.
buffering: st.buffering || st.reconnecting,
error: !!st.error,
};
}