From fcc61867963b07e23bb87c603b5c87b42067c0f3 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:25:19 +0100 Subject: [PATCH] fix: dedupe live TV timeline heartbeat, delay initial send --- lib/screens/video_player_screen.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/screens/video_player_screen.dart b/lib/screens/video_player_screen.dart index 7722fe45..654beeae 100644 --- a/lib/screens/video_player_screen.dart +++ b/lib/screens/video_player_screen.dart @@ -1009,7 +1009,6 @@ class VideoPlayerScreenState extends State with WidgetsBindin _trackManager?.mediaInfo = null; } - _startLiveTimelineUpdates(); } catch (e) { appLogger.e('Failed to start live TV playback', error: e); _sendLiveTimeline('stopped'); @@ -2049,8 +2048,15 @@ class VideoPlayerScreenState extends State with WidgetsBindin final state = player?.state.playing == true ? 'playing' : 'paused'; _sendLiveTimeline(state); }); - // Send initial heartbeat immediately - _sendLiveTimeline('playing'); + // Delay initial heartbeat to let the transcode session stabilize. + // Sending time=0 immediately after player.open() causes the server + // to spawn a duplicate transcode job with offset=-1 that 404s. + Future.delayed(const Duration(seconds: 3), () { + if (_liveTimelineTimer != null) { + final state = player?.state.playing == true ? 'playing' : 'paused'; + _sendLiveTimeline(state); + } + }); } void _stopLiveTimelineUpdates() {