mod: 新增画中画不加载弹幕设置

This commit is contained in:
orz12
2024-03-15 21:10:40 +08:00
parent 8744f89bac
commit 9e57805ab6
3 changed files with 33 additions and 8 deletions

View File

@@ -143,6 +143,13 @@ class _PlaySettingState extends State<PlaySetting> {
setKey: SettingBoxKey.autoPiP, setKey: SettingBoxKey.autoPiP,
defaultVal: false, defaultVal: false,
), ),
if (Platform.isAndroid)
const SetSwitchItem(
title: '画中画不加载弹幕',
subTitle: '当弹幕开关开启时,小窗屏蔽弹幕以获得较好的体验',
setKey: SettingBoxKey.pipNoDanmaku,
defaultVal: true,
),
const SetSwitchItem( const SetSwitchItem(
title: '全屏手势反向', title: '全屏手势反向',
subTitle: '默认播放器中部向上滑动进入全屏,向下退出\n开启后向下全屏,向上退出', subTitle: '默认播放器中部向上滑动进入全屏,向下退出\n开启后向下全屏,向上退出',

View File

@@ -58,6 +58,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
late bool horizontalScreen; late bool horizontalScreen;
late bool enableVerticalExpand; late bool enableVerticalExpand;
late bool autoPiP; late bool autoPiP;
late bool pipNoDanmaku;
final Floating floating = Floating(); final Floating floating = Floating();
// 生命周期监听 // 生命周期监听
// late final AppLifecycleListener _lifecycleListener; // late final AppLifecycleListener _lifecycleListener;
@@ -95,6 +96,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
autoPlayEnable = autoPlayEnable =
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
autoPiP = setting.get(SettingBoxKey.autoPiP, defaultValue: false); autoPiP = setting.get(SettingBoxKey.autoPiP, defaultValue: false);
pipNoDanmaku = setting.get(SettingBoxKey.pipNoDanmaku, defaultValue: true);
enableVerticalExpand = enableVerticalExpand =
setting.get(SettingBoxKey.enableVerticalExpand, defaultValue: false); setting.get(SettingBoxKey.enableVerticalExpand, defaultValue: false);
videoSourceInit(); videoSourceInit();
@@ -226,12 +228,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
setState(() {}); setState(() {});
} }
// if (!status) { // if (!status) {
// showStatusBar(); // showStatusBar();
// if (horizontalScreen) { // if (horizontalScreen) {
// autoScreen(); // autoScreen();
// } else { // } else {
// verticalScreenForTwoSeconds(); // verticalScreenForTwoSeconds();
// } // }
// } // }
}); });
} }
@@ -384,12 +386,17 @@ class _VideoDetailPageState extends State<VideoDetailPage>
} }
if (MediaQuery.of(context).orientation == if (MediaQuery.of(context).orientation ==
Orientation.landscape && Orientation.landscape &&
!horizontalScreen && !isFullScreen.value && isShowing && mounted) { !horizontalScreen &&
!isFullScreen.value &&
isShowing &&
mounted) {
hideStatusBar(); hideStatusBar();
} }
if (MediaQuery.of(context).orientation == if (MediaQuery.of(context).orientation ==
Orientation.portrait && Orientation.portrait &&
!isFullScreen.value && isShowing && mounted) { !isFullScreen.value &&
isShowing &&
mounted) {
showStatusBar(); showStatusBar();
} }
return SizedBox( return SizedBox(
@@ -863,6 +870,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
controller: plPlayerController, controller: plPlayerController,
videoDetailCtr: videoDetailController, videoDetailCtr: videoDetailController,
), ),
danmuWidget: pipNoDanmaku
? null
: Obx(
() => PlDanmaku(
key: Key(
videoDetailController.danmakuCid.value.toString()),
cid: videoDetailController.danmakuCid.value,
playerController: plPlayerController!,
),
),
), ),
); );
if (!horizontalScreen) { if (!horizontalScreen) {

View File

@@ -98,6 +98,7 @@ class SettingBoxKey {
p1080 = 'p1080', p1080 = 'p1080',
enableCDN = 'enableCDN', enableCDN = 'enableCDN',
autoPiP = 'autoPiP', autoPiP = 'autoPiP',
pipNoDanmaku = 'pipNoDanmaku',
enableAutoLongPressSpeed = 'enableAutoLongPressSpeed', enableAutoLongPressSpeed = 'enableAutoLongPressSpeed',
subtitlePreference = 'subtitlePreference', subtitlePreference = 'subtitlePreference',