Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-18 11:27:56 +08:00
parent 52498b3e34
commit 464f008023
4 changed files with 43 additions and 17 deletions

View File

@@ -309,10 +309,11 @@ class PlPlayerController {
}
}
void enterPip() {
void enterPip({bool isAuto = false}) {
if (videoController != null) {
final state = videoController!.player.state;
PageUtils.enterPip(
isAuto: isAuto,
width: state.width ?? width,
height: state.height ?? height,
);
@@ -556,12 +557,16 @@ class PlPlayerController {
}
if (Platform.isAndroid && autoPiP) {
Utils.channel.setMethodCallHandler((call) async {
if (call.method == 'onUserLeaveHint') {
if (playerStatus.status.value == PlayerStatus.playing &&
Get.currentRoute.startsWith('/video')) {
enterPip();
}
Utils.sdkInt.then((sdkInt) {
if (sdkInt < 12) {
Utils.channel.setMethodCallHandler((call) async {
if (call.method == 'onUserLeaveHint') {
if (playerStatus.playing &&
Get.currentRoute.startsWith('/video')) {
enterPip();
}
}
});
}
});
}