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',