wire android pip state, fix loading overlay during rebuffers, and bump native player fork

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tommy Chow 2026-03-15 22:29:26 -07:00
parent 9c7bef6f3a
commit 2bfc631c53
6 changed files with 34 additions and 2 deletions

View file

@ -753,6 +753,8 @@ class _VideoChatState extends State<VideoChat>
return PipWidget(
pipLayout: PipActionsLayout.mediaOnlyPause,
onPipAction: (_) => _videoStore.handlePausePlay(),
onPipEntered: () => _videoStore.handleAndroidPipChanged(true),
onPipExited: () => _videoStore.handleAndroidPipChanged(false),
pipChild: player,
child: videoChat,
);

View file

@ -315,7 +315,7 @@ abstract class NativeVideoStoreBase with Store implements VideoPlayerInterface {
}
case PlayerActivityState.buffering:
case PlayerActivityState.loading:
if (!_isQualitySwitching) {
if (!_isQualitySwitching && !_hasPlayedOnce) {
_loading = true;
}
// Clear _initializing on the first buffering event so the stall
@ -695,6 +695,18 @@ abstract class NativeVideoStoreBase with Store implements VideoPlayerInterface {
}
}
@override
@action
void handleAndroidPipChanged(bool isInPip) {
if (isInPip && !_isInPipMode) {
_isInPipMode = true;
_overlayTimer?.cancel();
_overlayVisible = true;
} else if (!isInPip && _isInPipMode) {
_isInPipMode = false;
}
}
@override
@action
void dispose() {

View file

@ -382,6 +382,18 @@ mixin _$NativeVideoStore on NativeVideoStoreBase, Store {
}
}
@override
void handleAndroidPipChanged(bool isInPip) {
final _$actionInfo = _$NativeVideoStoreBaseActionController.startAction(
name: 'NativeVideoStoreBase.handleAndroidPipChanged',
);
try {
return super.handleAndroidPipChanged(isInPip);
} finally {
_$NativeVideoStoreBaseActionController.endAction(_$actionInfo);
}
}
@override
void dispose() {
final _$actionInfo = _$NativeVideoStoreBaseActionController.startAction(

View file

@ -27,5 +27,6 @@ abstract class VideoPlayerInterface {
Future<void> setStreamQuality(String quality);
Future<void> updateStreamInfo({bool forceUpdate});
void handleAppResume();
void handleAndroidPipChanged(bool isInPip);
void dispose();
}

View file

@ -976,6 +976,11 @@ abstract class VideoStoreBase with Store implements VideoPlayerInterface {
}
}
@override
void handleAndroidPipChanged(bool isInPip) {
// Webview player handles PiP independently via JavaScript channels.
}
/// Updates the stream info from the Twitch API.
///
/// If the stream is offline, fetches channel information to show offline details.

View file

@ -102,7 +102,7 @@ packages:
description:
path: "."
ref: frosty-patches
resolved-ref: "0d012ce85a684d0e6772c3f9bdffced3eacd488a"
resolved-ref: b58871378daf78bcd2622257c9ebd212c308fb40
url: "https://github.com/tommyxchow/flutter-native-video-player.git"
source: git
version: "0.4.11"