From 9e57805ab67819f4009a1ab0517d959a24ea76b9 Mon Sep 17 00:00:00 2001 From: orz12 Date: Fri, 15 Mar 2024 21:10:40 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20=E6=96=B0=E5=A2=9E=E7=94=BB=E4=B8=AD?= =?UTF-8?q?=E7=94=BB=E4=B8=8D=E5=8A=A0=E8=BD=BD=E5=BC=B9=E5=B9=95=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/setting/play_setting.dart | 7 ++++++ lib/pages/video/detail/view.dart | 33 ++++++++++++++++++++++------- lib/utils/storage.dart | 1 + 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/pages/setting/play_setting.dart b/lib/pages/setting/play_setting.dart index 0f544d2c..f004d283 100644 --- a/lib/pages/setting/play_setting.dart +++ b/lib/pages/setting/play_setting.dart @@ -143,6 +143,13 @@ class _PlaySettingState extends State { setKey: SettingBoxKey.autoPiP, defaultVal: false, ), + if (Platform.isAndroid) + const SetSwitchItem( + title: '画中画不加载弹幕', + subTitle: '当弹幕开关开启时,小窗屏蔽弹幕以获得较好的体验', + setKey: SettingBoxKey.pipNoDanmaku, + defaultVal: true, + ), const SetSwitchItem( title: '全屏手势反向', subTitle: '默认播放器中部向上滑动进入全屏,向下退出\n开启后向下全屏,向上退出', diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index cd20ca96..73bd108b 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -58,6 +58,7 @@ class _VideoDetailPageState extends State late bool horizontalScreen; late bool enableVerticalExpand; late bool autoPiP; + late bool pipNoDanmaku; final Floating floating = Floating(); // 生命周期监听 // late final AppLifecycleListener _lifecycleListener; @@ -95,6 +96,7 @@ class _VideoDetailPageState extends State autoPlayEnable = setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); autoPiP = setting.get(SettingBoxKey.autoPiP, defaultValue: false); + pipNoDanmaku = setting.get(SettingBoxKey.pipNoDanmaku, defaultValue: true); enableVerticalExpand = setting.get(SettingBoxKey.enableVerticalExpand, defaultValue: false); videoSourceInit(); @@ -226,12 +228,12 @@ class _VideoDetailPageState extends State setState(() {}); } // if (!status) { - // showStatusBar(); - // if (horizontalScreen) { - // autoScreen(); - // } else { - // verticalScreenForTwoSeconds(); - // } + // showStatusBar(); + // if (horizontalScreen) { + // autoScreen(); + // } else { + // verticalScreenForTwoSeconds(); + // } // } }); } @@ -384,12 +386,17 @@ class _VideoDetailPageState extends State } if (MediaQuery.of(context).orientation == Orientation.landscape && - !horizontalScreen && !isFullScreen.value && isShowing && mounted) { + !horizontalScreen && + !isFullScreen.value && + isShowing && + mounted) { hideStatusBar(); } if (MediaQuery.of(context).orientation == Orientation.portrait && - !isFullScreen.value && isShowing && mounted) { + !isFullScreen.value && + isShowing && + mounted) { showStatusBar(); } return SizedBox( @@ -863,6 +870,16 @@ class _VideoDetailPageState extends State controller: plPlayerController, videoDetailCtr: videoDetailController, ), + danmuWidget: pipNoDanmaku + ? null + : Obx( + () => PlDanmaku( + key: Key( + videoDetailController.danmakuCid.value.toString()), + cid: videoDetailController.danmakuCid.value, + playerController: plPlayerController!, + ), + ), ), ); if (!horizontalScreen) { diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 48537365..b7204a46 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -98,6 +98,7 @@ class SettingBoxKey { p1080 = 'p1080', enableCDN = 'enableCDN', autoPiP = 'autoPiP', + pipNoDanmaku = 'pipNoDanmaku', enableAutoLongPressSpeed = 'enableAutoLongPressSpeed', subtitlePreference = 'subtitlePreference',