From 28b4c163988cad592e6e207c18013f0c8c9f6121 Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Sun, 15 Mar 2026 16:47:15 -0700 Subject: [PATCH] fix black overlay during rebuffers and bump native player fork Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/screens/channel/video/native_video.dart | 2 +- .../channel/video/native_video_store.dart | 5 +++++ .../channel/video/native_video_store.g.dart | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/screens/channel/video/native_video.dart b/lib/screens/channel/video/native_video.dart index 6d4b21ab..103de384 100644 --- a/lib/screens/channel/video/native_video.dart +++ b/lib/screens/channel/video/native_video.dart @@ -31,7 +31,7 @@ class NativeVideo extends StatelessWidget { key: ObjectKey(controller), controller: controller, ), - if (controller != null && nativeVideoStore.loading && !isOffline) + if (controller != null && !nativeVideoStore.hasPlayedOnce && !isOffline) const ColoredBox( color: Colors.black, child: SizedBox.expand(), diff --git a/lib/screens/channel/video/native_video_store.dart b/lib/screens/channel/video/native_video_store.dart index a521cd6b..9defbbe1 100644 --- a/lib/screens/channel/video/native_video_store.dart +++ b/lib/screens/channel/video/native_video_store.dart @@ -74,6 +74,9 @@ abstract class NativeVideoStoreBase with Store implements VideoPlayerInterface { @readonly var _paused = true; + @readonly + var _hasPlayedOnce = false; + @readonly var _overlayVisible = true; @@ -299,6 +302,7 @@ abstract class NativeVideoStoreBase with Store implements VideoPlayerInterface { case PlayerActivityState.playing: _loading = false; _paused = false; + _hasPlayedOnce = true; _initializing = false; _isQualitySwitching = false; _stallRecoveryTimer?.cancel(); @@ -534,6 +538,7 @@ abstract class NativeVideoStoreBase with Store implements VideoPlayerInterface { } _loading = true; _paused = true; + _hasPlayedOnce = false; _userPaused = false; _stallRecoveryAttempt = 0; _highLatencyCount = 0; diff --git a/lib/screens/channel/video/native_video_store.g.dart b/lib/screens/channel/video/native_video_store.g.dart index bb55e0aa..ca6052bf 100644 --- a/lib/screens/channel/video/native_video_store.g.dart +++ b/lib/screens/channel/video/native_video_store.g.dart @@ -77,6 +77,26 @@ mixin _$NativeVideoStore on NativeVideoStoreBase, Store { }); } + late final _$_hasPlayedOnceAtom = Atom( + name: 'NativeVideoStoreBase._hasPlayedOnce', + context: context, + ); + + bool get hasPlayedOnce { + _$_hasPlayedOnceAtom.reportRead(); + return super._hasPlayedOnce; + } + + @override + bool get _hasPlayedOnce => hasPlayedOnce; + + @override + set _hasPlayedOnce(bool value) { + _$_hasPlayedOnceAtom.reportWrite(value, super._hasPlayedOnce, () { + super._hasPlayedOnce = value; + }); + } + late final _$_overlayVisibleAtom = Atom( name: 'NativeVideoStoreBase._overlayVisible', context: context,