From 3bf72d723725941a29ca76d66733b2aa7f553835 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Fri, 10 Jul 2026 19:07:29 +0200 Subject: [PATCH] fix(player): auto-reconnect network streams on transient HTTP 503 ffmpeg's reconnect gave up on the first HTTP-error response, so a PMS answering 503 (startup maintenance) after an idle-pause disconnect surfaced as a clean mid-file EOF instead of riding through the outage. --- lib/screens/video_player/parts/playback_open.dart | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/screens/video_player/parts/playback_open.dart b/lib/screens/video_player/parts/playback_open.dart index 7fde3eea..52d86a55 100644 --- a/lib/screens/video_player/parts/playback_open.dart +++ b/lib/screens/video_player/parts/playback_open.dart @@ -491,9 +491,20 @@ extension _VideoPlayerOpenMethods on VideoPlayerScreenState { }) async { if (isNetworkVod) { // Covers network drops up to 10 min; applies to transcode streams too. + // + // reconnect_on_http_error=503: without it, ffmpeg abandons a reconnect + // that gets an HTTP error and the truncated body surfaces as a clean + // mid-file EOF (#1520 — PMS answers 503 while restarting/maintenance). + // Deliberately 503 only: a persistent 500 must keep failing fast so the + // server-limit dialog (_server500Pattern) appears promptly, and a + // multi-code list would need mpv's %len% quoting to survive the + // comma-separated option string. While ffmpeg retries, mpv reports + // buffering, which also makes the server-online reconnect hook in + // _wirePlayerStreams reachable. await player.setProperty( 'stream-lavf-o', - 'reconnect=1,reconnect_on_network_error=1,reconnect_streamed=1,reconnect_delay_max=600', + 'reconnect=1,reconnect_on_network_error=1,reconnect_on_http_error=503,' + 'reconnect_streamed=1,reconnect_delay_max=600', ); } else { await player.setProperty('stream-lavf-o', '');