From b2c3b1ff95b75ea1a7ab918de321158884233743 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Thu, 6 Feb 2025 12:01:33 +0800 Subject: [PATCH] fix: #199 Signed-off-by: bggRGjQaUbCoE --- lib/pages/video/detail/view.dart | 6 ++++++ lib/plugin/pl_player/controller.dart | 6 ++++-- lib/plugin/pl_player/view.dart | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index c403f6d9..eab1ace5 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -417,6 +417,12 @@ class _VideoDetailPageState extends State return; } + if (videoDetailController.plPlayerController.playerStatus.status.value == + PlayerStatus.playing && + videoDetailController.playerStatus != PlayerStatus.playing) { + videoDetailController.plPlayerController.pause(); + } + isShowing = true; PlPlayerController.setPlayCallBack(playCallBack); videoIntroController.startTimer(); diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index f82dcc20..bff0028e 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -285,7 +285,7 @@ class PlPlayerController { // 播放顺序相关 PlayRepeat playRepeat = PlayRepeat.pause; - final GlobalKey key = GlobalKey(); + GlobalKey key = GlobalKey(); TextStyle get subTitleStyle => TextStyle( height: 1.5, @@ -1496,7 +1496,9 @@ class PlPlayerController { if (type == 'single' && playerCount.value > 1) { _playerCount.value -= 1; _heartDuration = 0; - pause(); + if (!Get.previousRoute.startsWith('/video')) { + pause(); + } return; } _playerCount.value = 0; diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 32c0e481..289bc413 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -154,6 +154,7 @@ class _PLVideoPlayerState extends State @override void initState() { super.initState(); + plPlayerController.key = GlobalKey(); animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 100)); videoController = plPlayerController.videoController!;