Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-18 17:21:14 +08:00
parent d908f58528
commit 6ca0de96f4
2 changed files with 20 additions and 5 deletions

View File

@@ -2149,6 +2149,9 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
}
void _onPopInvokedWithResult(bool didPop, result) {
if (didPop) {
videoDetailController.plPlayerController.disableAutoEnterPipIfNeeded();
}
if (plPlayerController?.controlsLock.value == true) {
plPlayerController?.onLockControl(false);
return;

View File

@@ -310,12 +310,19 @@ class PlPlayerController {
}
late bool _shouldSetPip = false;
bool get _isVideoPage {
bool get _isCurrVideoPage {
final currentRoute = Get.currentRoute;
return currentRoute.startsWith('/video') ||
currentRoute.startsWith('/liveRoom');
}
bool get _isPreviousVideoPage {
final previousRoute = Get.previousRoute;
return previousRoute.startsWith('/video') ||
previousRoute.startsWith('/liveRoom');
}
void enterPip({bool isAuto = false}) {
if (videoController != null) {
final state = videoController!.player.state;
@@ -327,6 +334,12 @@ class PlPlayerController {
}
}
void disableAutoEnterPipIfNeeded() {
if (!_isPreviousVideoPage) {
disableAutoEnterPip();
}
}
void disableAutoEnterPip() {
if (_shouldSetPip) {
Utils.channel.invokeMethod('setPipAutoEnterEnabled', {
@@ -576,7 +589,7 @@ class PlPlayerController {
if (sdkInt < 31) {
Utils.channel.setMethodCallHandler((call) async {
if (call.method == 'onUserLeaveHint') {
if (playerStatus.playing && _isVideoPage) {
if (playerStatus.playing && _isCurrVideoPage) {
enterPip();
}
}
@@ -1025,7 +1038,7 @@ class PlPlayerController {
videoPlayerController!.stream.playing.listen((event) {
if (event) {
if (_shouldSetPip) {
if (_isVideoPage) {
if (_isCurrVideoPage) {
enterPip(isAuto: true);
} else {
disableAutoEnterPip();
@@ -1720,8 +1733,7 @@ class PlPlayerController {
if (!isCloseAll && _playerCount > 1) {
_playerCount -= 1;
_heartDuration = 0;
if (!_isVideoPage) {
disableAutoEnterPip();
if (!_isPreviousVideoPage) {
pause();
}
return;