From a9f7d2f3a6aca7e29b04834b65da7955612aba96 Mon Sep 17 00:00:00 2001 From: orz12 Date: Thu, 13 Jun 2024 20:32:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8D=95=E4=B8=AA=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E3=80=81=E7=BB=A7=E7=BB=AD=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E6=97=B6=E6=8E=A7=E4=BB=B6=E8=B7=B3=E8=B7=83=E3=80=81=E5=86=97?= =?UTF-8?q?=E4=BD=99=E5=8F=82=E6=95=B0=E7=A7=BB=E9=99=A4=E3=80=81typo?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 13 ++++++------- lib/plugin/pl_player/controller.dart | 19 +++++++------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index dfefc53f..b079be3a 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -53,7 +53,7 @@ class _VideoDetailPageState extends State final Box setting = GStrorage.setting; late Future _futureBuilderFuture; // 自动退出全屏 - late bool autoExitFullcreen; + late bool autoExitFullscreen; late bool autoPlayEnable; late bool horizontalScreen; late bool enableVerticalExpand; @@ -94,7 +94,7 @@ class _VideoDetailPageState extends State videoPlayerServiceHandler.onVideoDetailChange( bangumiIntroController.bangumiDetail.value, p0); }); - autoExitFullcreen = + autoExitFullscreen = setting.get(SettingBoxKey.enableAutoExit, defaultValue: true); horizontalScreen = setting.get(SettingBoxKey.horizontalScreen, defaultValue: false); @@ -174,16 +174,15 @@ class _VideoDetailPageState extends State /// 单个循环 if (plPlayerController!.playRepeat == PlayRepeat.singleCycle) { notExitFlag = true; - plPlayerController!.seekTo(Duration.zero); - plPlayerController!.play(); + plPlayerController!.play(repeat: true); } // 结束播放退出全屏 - if (!notExitFlag && autoExitFullcreen) { + if (!notExitFlag && autoExitFullscreen) { plPlayerController!.triggerFullScreen(status: false); } // 播放完展示控制栏 - if (videoDetailController.floating != null) { + if (videoDetailController.floating != null && !notExitFlag) { PiPStatus currentStatus = await videoDetailController.floating!.pipStatus; if (currentStatus == PiPStatus.disabled) { @@ -311,7 +310,7 @@ class _VideoDetailPageState extends State videoDetailController.isFirstTime = false; final bool autoplay = autoPlayEnable; videoDetailController.autoPlay.value = - !videoDetailController.isShowCover.value; + !videoDetailController.isShowCover.value; await videoDetailController.playerInit(autoplay: autoplay); /// 未开启自动播放时,未播放跳转下一页返回/播放后跳转下一页返回 diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 69a5100e..ce24912d 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -289,9 +289,9 @@ class PlPlayerController { } static Future playIfExists( - {bool repeat = false, bool hideControls = true, dynamic duration}) async { + {bool repeat = false, bool hideControls = true}) async { await _instance?.play( - repeat: repeat, hideControls: hideControls, duration: duration); + repeat: repeat, hideControls: hideControls); } // try to get PlayerStatus @@ -610,8 +610,7 @@ class PlPlayerController { // 开始播放 Future _initializePlayer({ - Duration seekTo = Duration.zero, - Duration? duration, + Duration seekTo = Duration.zero }) async { if (_instance == null) return; // 设置倍速 @@ -636,7 +635,7 @@ class PlPlayerController { // 自动播放 if (_autoPlay) { - await playIfExists(duration: duration); + await playIfExists(); // await play(duration: duration); } } @@ -831,20 +830,16 @@ class PlPlayerController { /// 播放视频 /// TODO _duration.value丢失 Future play( - {bool repeat = false, bool hideControls = true, dynamic duration}) async { + {bool repeat = false, bool hideControls = true}) async { if (_playerCount.value == 0) return; // 播放时自动隐藏控制条 controls = !hideControls; // repeat为true,将从头播放 if (repeat) { - await seekTo(Duration.zero); + // await seekTo(Duration.zero); + await seekTo(Duration.zero, type: "slider"); } - /// 临时fix _duration.value丢失 - if (duration != null) { - _duration.value = duration; - updateDurationSecond(); - } await _videoPlayerController?.play(); await getCurrentVolume();