Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-18 15:57:41 +08:00
parent c9ce1af2c6
commit 32e71dbf65
3 changed files with 19 additions and 12 deletions

View File

@@ -275,17 +275,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
}
}
}
if (Platform.isAndroid &&
plPlayerController!.autoPiP &&
await Utils.sdkInt >= 12) {
if (isPlaying) {
plPlayerController!.enterPip(isAuto: true);
} else {
Utils.channel.invokeMethod('setPipAutoEnterEnabled', {
'autoEnable': false,
});
}
}
}
// 继续播放或重新播放

View File

@@ -309,6 +309,8 @@ class PlPlayerController {
}
}
late bool shouldSetPip = false;
void enterPip({bool isAuto = false}) {
if (videoController != null) {
final state = videoController!.player.state;
@@ -320,6 +322,14 @@ class PlPlayerController {
}
}
void disableAutoEnterPip() {
if (shouldSetPip) {
Utils.channel.invokeMethod('setPipAutoEnterEnabled', {
'autoEnable': false,
});
}
}
/// 弹幕权重
late final enableTapDm = Utils.isMobile && Pref.enableTapDm;
late int danmakuWeight = Pref.danmakuWeight;
@@ -567,6 +577,8 @@ class PlPlayerController {
}
}
});
} else {
shouldSetPip = true;
}
});
}
@@ -1008,8 +1020,12 @@ class PlPlayerController {
subscriptions = {
videoPlayerController!.stream.playing.listen((event) {
if (event) {
if (shouldSetPip) {
enterPip(isAuto: true);
}
playerStatus.status.value = PlayerStatus.playing;
} else {
disableAutoEnterPip();
playerStatus.status.value = PlayerStatus.paused;
}
videoPlayerServiceHandler?.onStatusChange(
@@ -1699,10 +1715,12 @@ class PlPlayerController {
final previousRoute = Get.previousRoute;
if (!previousRoute.startsWith('/video') &&
!previousRoute.startsWith('/liveRoom')) {
disableAutoEnterPip();
pause();
}
return;
}
disableAutoEnterPip();
setPlayCallBack(null);
dmState.clear();
_playerCount = 0;