From faaf416bf0da475001baca8e0e294b0ce08f0abb Mon Sep 17 00:00:00 2001 From: orz12 Date: Wed, 20 Dec 2023 13:49:58 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E5=BC=B9=E5=B9=95?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?speed=E6=94=B9=E4=B8=BAduration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 1 + lib/pages/danmaku/view.dart | 11 ++++++----- .../video/detail/widgets/header_control.dart | 18 +++++++++--------- lib/plugin/pl_player/controller.dart | 10 +++++----- lib/utils/storage.dart | 4 ++-- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 06845daf..1198b6fc 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -63,6 +63,7 @@ android { versionCode flutterVersionCode.toInteger() versionName flutterVersionName minSdkVersion 19 + multiDexEnabled true } signingConfigs { diff --git a/lib/pages/danmaku/view.dart b/lib/pages/danmaku/view.dart index dd7558d5..1ff7677c 100644 --- a/lib/pages/danmaku/view.dart +++ b/lib/pages/danmaku/view.dart @@ -34,7 +34,7 @@ class _PlDanmakuState extends State { late double showArea; late double opacityVal; late double fontSizeVal; - late double danmakuSpeedVal; + late double danmakuDurationVal; @override void initState() { @@ -68,7 +68,7 @@ class _PlDanmakuState extends State { showArea = playerController.showArea; opacityVal = playerController.opacityVal; fontSizeVal = playerController.fontSizeVal; - danmakuSpeedVal = playerController.danmakuSpeedVal; + danmakuDurationVal = playerController.danmakuDurationVal; } // 播放器状态监听 @@ -156,7 +156,7 @@ class _PlDanmakuState extends State { @override Widget build(BuildContext context) { return LayoutBuilder(builder: (context, box) { - double initDuration = box.maxWidth / 12; + // double initDuration = box.maxWidth / 12; return Obx( () => AnimatedOpacity( opacity: playerController.isOpenDanmu.value ? 1 : 0, @@ -172,8 +172,9 @@ class _PlDanmakuState extends State { hideTop: blockTypes.contains(5), hideScroll: blockTypes.contains(2), hideBottom: blockTypes.contains(4), - duration: initDuration / - (danmakuSpeedVal * widget.playerController.playbackSpeed), + duration: danmakuDurationVal / widget.playerController.playbackSpeed, + // initDuration / + // (danmakuSpeedVal * widget.playerController.playbackSpeed), ), statusChanged: (isPlaying) {}, ), diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index 5c2491a0..fc9f9b0a 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -585,7 +585,7 @@ class _HeaderControlState extends State { // 字体大小 double fontSizeVal = widget.controller!.fontSizeVal; // 弹幕速度 - double danmakuSpeedVal = widget.controller!.danmakuSpeedVal; + double danmakuDurationVal = widget.controller!.danmakuDurationVal; DanmakuController danmakuController = widget.controller!.danmakuController!; await showModalBottomSheet( @@ -755,7 +755,7 @@ class _HeaderControlState extends State { ), ), ), - Text('弹幕时长 ${danmakuSpeedVal.toString()}'), + Text('弹幕时长 ${danmakuDurationVal.toString()}'), Padding( padding: const EdgeInsets.only( top: 0, @@ -773,14 +773,14 @@ class _HeaderControlState extends State { enabledThumbRadius: 6.0), ), child: Slider( - min: 1, - max: 8, - value: danmakuSpeedVal, - divisions: 14, - label: danmakuSpeedVal.toString(), + min: 2, + max: 16, + value: danmakuDurationVal, + divisions: 28, + label: danmakuDurationVal.toString(), onChanged: (double val) { - danmakuSpeedVal = val; - widget.controller!.danmakuSpeedVal = danmakuSpeedVal; + danmakuDurationVal = val; + widget.controller!.danmakuDurationVal = danmakuDurationVal; setState(() {}); try { DanmakuOption currentOption = diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index ff3857ba..6e4aa93b 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -221,7 +221,7 @@ class PlPlayerController { late double showArea; late double opacityVal; late double fontSizeVal; - late double danmakuSpeedVal; + late double danmakuDurationVal; late List speedsList; // 缓存 double? defaultDuration; @@ -268,9 +268,9 @@ class PlPlayerController { // 字体大小 fontSizeVal = localCache.get(LocalCacheKey.danmakuFontScale, defaultValue: 1.0); - // 弹幕速度 - danmakuSpeedVal = - localCache.get(LocalCacheKey.danmakuSpeed, defaultValue: 4.0); + // 弹幕时间 + danmakuDurationVal = + localCache.get(LocalCacheKey.danmakuDuration, defaultValue: 4.0); playRepeat = PlayRepeat.values.toList().firstWhere( (e) => e.value == @@ -1097,7 +1097,7 @@ class PlPlayerController { localCache.put(LocalCacheKey.danmakuShowArea, showArea); localCache.put(LocalCacheKey.danmakuOpacity, opacityVal); localCache.put(LocalCacheKey.danmakuFontScale, fontSizeVal); - localCache.put(LocalCacheKey.danmakuSpeed, danmakuSpeedVal); + localCache.put(LocalCacheKey.danmakuDuration, danmakuDurationVal); var pp = _videoPlayerController!.platform as NativePlayer; await pp.setProperty('audio-files', ''); diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 3f187638..44cb162a 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -154,12 +154,12 @@ class LocalCacheKey { static const String wbiKeys = 'wbiKeys'; static const String timeStamp = 'timeStamp'; - // 弹幕相关设置 屏蔽类型 显示区域 透明度 字体大小 弹幕速度 + // 弹幕相关设置 屏蔽类型 显示区域 透明度 字体大小 弹幕时间 static const String danmakuBlockType = 'danmakuBlockType'; static const String danmakuShowArea = 'danmakuShowArea'; static const String danmakuOpacity = 'danmakuOpacity'; static const String danmakuFontScale = 'danmakuFontScale'; - static const String danmakuSpeed = 'danmakuSpeed'; + static const String danmakuDuration = 'danmakuDuration'; // 代理host port static const String systemProxyHost = 'systemProxyHost'; From 46919596eaa2d9e855f12ad0853b990c996365e7 Mon Sep 17 00:00:00 2001 From: orz12 Date: Wed, 20 Dec 2023 14:16:03 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=E8=AE=BE=E5=AE=9A=E6=97=B6=E9=99=A4?= =?UTF-8?q?=E4=BB=A5=E5=BD=93=E5=89=8D=E6=92=AD=E6=94=BE=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/widgets/header_control.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index fc9f9b0a..c07afbb6 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -755,7 +755,7 @@ class _HeaderControlState extends State { ), ), ), - Text('弹幕时长 ${danmakuDurationVal.toString()}'), + Text('弹幕时长 ${danmakuDurationVal.toString()} 秒'), Padding( padding: const EdgeInsets.only( top: 0, @@ -786,7 +786,8 @@ class _HeaderControlState extends State { DanmakuOption currentOption = danmakuController.option; DanmakuOption updatedOption = - currentOption.copyWith(duration: val); + currentOption.copyWith(duration: + val/widget.controller!.playbackSpeed); danmakuController.updateOption(updatedOption); } catch (_) {} }, From e651ae6232c2e6c738a61675b6ca2ebe11ce745a Mon Sep 17 00:00:00 2001 From: orz12 Date: Wed, 20 Dec 2023 15:56:04 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E7=AB=96=E5=B1=8F=E9=9D=9E=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E7=8A=B6=E6=80=81=E5=B0=8F=E7=99=BD=E6=9D=A1=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 96a8b8fd..af51f941 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -244,7 +244,8 @@ class _VideoDetailPageState extends State } Widget childWhenDisabled = SafeArea( top: MediaQuery.of(context).orientation == Orientation.portrait, - bottom: MediaQuery.of(context).orientation == Orientation.portrait, + bottom: MediaQuery.of(context).orientation == Orientation.portrait + && plPlayerController!.isFullScreen.value, left: !plPlayerController!.isFullScreen.value, right: !plPlayerController!.isFullScreen.value, child: Stack( From 621a597d8f9b95a72c58bb0d32efab0a9a02add9 Mon Sep 17 00:00:00 2001 From: orz12 Date: Thu, 21 Dec 2023 12:23:01 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E7=AB=96=E5=B1=8F=E5=85=A8=E5=B1=8F?= =?UTF-8?q?=E4=B9=9F=E9=9A=90=E8=97=8F=E7=8A=B6=E6=80=81=E6=A0=8F=E4=B8=8E?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugin/pl_player/controller.dart | 33 ++++++---------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index ff3857ba..61155ad6 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -937,32 +937,13 @@ class PlPlayerController { if (!isFullScreen.value && status) { /// 按照视频宽高比决定全屏方向 toggleFullScreen(true); - switch (mode) { - case FullScreenMode.auto: - if (direction.value == 'horizontal') { - /// 进入全屏 - await enterFullScreen(); - // 横屏 - await landScape(); - } else { - // 竖屏 - await verticalScreen(); - } - break; - case FullScreenMode.vertical: - - /// 进入全屏 - await enterFullScreen(); - // 竖屏 - await verticalScreen(); - break; - case FullScreenMode.horizontal: - - /// 进入全屏 - await enterFullScreen(); - // 横屏 - await landScape(); - break; + /// 进入全屏 + await enterFullScreen(); + if(mode == FullScreenMode.vertical || + (mode == FullScreenMode.auto && direction.value == 'vertical')) { + await verticalScreen(); + } else { + await landScape(); } // bool isValid = From a10af323f9aca722fb87f416532a47177d21553c Mon Sep 17 00:00:00 2001 From: orz12 Date: Thu, 21 Dec 2023 12:24:08 +0800 Subject: [PATCH 5/6] =?UTF-8?q?bottom=20control=E5=B0=BA=E5=AF=B8=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E6=9B=B4=E6=98=93=E6=8B=96=E5=8A=A8=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugin/pl_player/widgets/bottom_control.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/plugin/pl_player/widgets/bottom_control.dart b/lib/plugin/pl_player/widgets/bottom_control.dart index dfb2c6a0..1fd8aa65 100644 --- a/lib/plugin/pl_player/widgets/bottom_control.dart +++ b/lib/plugin/pl_player/widgets/bottom_control.dart @@ -26,8 +26,8 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget { return Container( color: Colors.transparent, - height: 85, - padding: const EdgeInsets.only(left: 14, right: 14), + height: 90, + padding: const EdgeInsets.only(left: 18, right: 18), child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -50,8 +50,8 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget { bufferedBarColor: colorTheme.withOpacity(0.4), timeLabelLocation: TimeLabelLocation.none, thumbColor: colorTheme, - barHeight: 3.0, - thumbRadius: 5.5, + barHeight: 3.5, + thumbRadius: 7, onDragStart: (duration) { feedBack(); _.onChangedSliderStart(); From 6fb7b4ba73cff2983d1f786ee22a02bdec1af424 Mon Sep 17 00:00:00 2001 From: orz12 Date: Thu, 21 Dec 2023 19:21:13 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=E5=85=A8=E5=B1=8F=E6=97=B6=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E5=BA=95=E9=83=A8=E6=9C=89=E5=8F=AF=E8=83=BD=E6=BB=91?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index af51f941..f02fcd6d 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -433,7 +433,8 @@ class _VideoDetailPageState extends State // }, /// 不收回 pinnedHeaderSliverHeightBuilder: () { - return pinnedHeaderHeight; + return plPlayerController!.isFullScreen.value ? + MediaQuery.of(context).size.height: pinnedHeaderHeight; }, onlyOneScrollInBody: true, body: Container(