From b9a47da92bae0d82e3fb7431dcef4cc20a0c6bfd Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 10 Sep 2023 00:03:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=AA=E5=BC=80=E5=90=AF=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=92=AD=E6=94=BE=E6=97=B6=E6=92=AD=E6=94=BE=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=B8=A2=E5=A4=B1=20issues=20#82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 58935b45..79ac16d2 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -53,6 +53,7 @@ class _VideoDetailPageState extends State late Future _futureBuilderFuture; // 自动退出全屏 late bool autoExitFullcreen; + late bool autoPlayEnable; @override void initState() { @@ -63,6 +64,8 @@ class _VideoDetailPageState extends State statusBarHeight = localCache.get('statusBarHeight'); autoExitFullcreen = setting.get(SettingBoxKey.enableAutoExit, defaultValue: false); + autoPlayEnable = + setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); videoSourceInit(); appbarStreamListen(); } @@ -148,16 +151,18 @@ class _VideoDetailPageState extends State // 返回当前页面时 void didPopNext() async { videoDetailController.isFirstTime = false; - bool autoplay = - setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); + bool autoplay = autoPlayEnable; videoDetailController.playerInit(autoplay: autoplay); - videoDetailController.autoPlay.value = true; + + /// 未开启自动播放时,未播放跳转下一页返回/播放后跳转下一页返回 + videoDetailController.autoPlay.value = + !videoDetailController.isShowCover.value; videoIntroController.isPaused = false; if (_extendNestCtr.position.pixels == 0 && autoplay) { await Future.delayed(const Duration(milliseconds: 300)); - plPlayerController!.play(); + plPlayerController?.play(); } - plPlayerController!.addStatusLister(playerListener); + plPlayerController?.addStatusLister(playerListener); super.didPopNext(); }