From bce06da3b5ece27ebc11dc7e89c2e9f5e8ae501f Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Sat, 6 Jun 2026 17:28:59 -0700 Subject: [PATCH] fix(video): resolve transient offline refreshes and coordinate watchdog timings --- .../channel/video/native_video_store.dart | 17 ++++++++++------- .../channel/video/video_timing_constants.dart | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/screens/channel/video/native_video_store.dart b/lib/screens/channel/video/native_video_store.dart index 66efd479..90b52c78 100644 --- a/lib/screens/channel/video/native_video_store.dart +++ b/lib/screens/channel/video/native_video_store.dart @@ -757,7 +757,7 @@ abstract class NativeVideoStoreBase await updateStreamInfo(forceUpdate: true); if (_disposed) return; - if (wasOffline && _streamInfo != null && settingsStore.showVideo) { + if (wasOffline && _streamInfo != null && settingsStore.showVideo && !_userPaused) { debugPrint( 'NativeVideoStore: stream detected back online, auto-refreshing', ); @@ -1062,11 +1062,14 @@ abstract class NativeVideoStoreBase _offlineChannelInfo = null; return; } - _overlayTimer?.cancel(); - _latencyTimer?.cancel(); - _stallRecoveryTimer?.cancel(); - _healthyPlaybackTimer?.cancel(); - _loading = false; + if (result.offlineChannel == null) { + return; + } + _overlayTimer?.cancel(); + _latencyTimer?.cancel(); + _stallRecoveryTimer?.cancel(); + _healthyPlaybackTimer?.cancel(); + _loading = false; _latency = null; _streamInfo = null; _offlineChannelInfo = result.offlineChannel; @@ -1074,7 +1077,7 @@ abstract class NativeVideoStoreBase // Transient network errors leave chat state untouched. if (result.offlineChannel != null) _chatLatencySync.reset(); }); - } + } @override @action diff --git a/lib/screens/channel/video/video_timing_constants.dart b/lib/screens/channel/video/video_timing_constants.dart index 9b0f4795..6529497a 100644 --- a/lib/screens/channel/video/video_timing_constants.dart +++ b/lib/screens/channel/video/video_timing_constants.dart @@ -19,7 +19,7 @@ class VideoTimingConstants { /// A "play" event arriving within this window after a previous one is /// treated as a failed-recovery bounce rather than a fresh successful start. - static const shortPlayWindow = Duration(seconds: 3); + static const shortPlayWindow = Duration(seconds: 10); /// Number of short-play bounces required before surfacing a tailored error. static const int shortPlayLoopThreshold = 3;