mod: 双击快进/快退
This commit is contained in:
@ -60,6 +60,18 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
setKey: SettingBoxKey.autoPlayEnable,
|
setKey: SettingBoxKey.autoPlayEnable,
|
||||||
defaultVal: true,
|
defaultVal: true,
|
||||||
),
|
),
|
||||||
|
const SetSwitchItem(
|
||||||
|
title: '自动全屏',
|
||||||
|
subTitle: '视频开始播放时进入全屏',
|
||||||
|
setKey: SettingBoxKey.enableAutoEnter,
|
||||||
|
defaultVal: false,
|
||||||
|
),
|
||||||
|
const SetSwitchItem(
|
||||||
|
title: '自动退出',
|
||||||
|
subTitle: '视频结束播放时退出全屏',
|
||||||
|
setKey: SettingBoxKey.enableAutoExit,
|
||||||
|
defaultVal: false,
|
||||||
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '开启硬解',
|
title: '开启硬解',
|
||||||
subTitle: '以较低功耗播放视频',
|
subTitle: '以较低功耗播放视频',
|
||||||
@ -79,16 +91,10 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '自动全屏',
|
title: '双击快退/快进',
|
||||||
subTitle: '视频开始播放时进入全屏',
|
subTitle: '左侧双击快退,右侧双击快进',
|
||||||
setKey: SettingBoxKey.enableAutoEnter,
|
setKey: SettingBoxKey.enableQuickDouble,
|
||||||
defaultVal: false,
|
defaultVal: true,
|
||||||
),
|
|
||||||
const SetSwitchItem(
|
|
||||||
title: '自动退出',
|
|
||||||
subTitle: '视频结束播放时退出全屏',
|
|
||||||
setKey: SettingBoxKey.enableAutoExit,
|
|
||||||
defaultVal: false,
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
|
@ -69,6 +69,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
late FullScreenMode mode;
|
late FullScreenMode mode;
|
||||||
late int defaultBtmProgressBehavior;
|
late int defaultBtmProgressBehavior;
|
||||||
|
late bool enableQuickDouble;
|
||||||
|
|
||||||
void onDoubleTapSeekBackward() {
|
void onDoubleTapSeekBackward() {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -82,6 +83,36 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 双击播放、暂停
|
||||||
|
void onDoubleTapCenter() {
|
||||||
|
final _ = widget.controller;
|
||||||
|
if (_.playerStatus.status.value == PlayerStatus.playing) {
|
||||||
|
_.togglePlay();
|
||||||
|
} else {
|
||||||
|
_.play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
doubleTapFuc(String type) {
|
||||||
|
if (!enableQuickDouble) {
|
||||||
|
onDoubleTapCenter();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (type) {
|
||||||
|
case 'left':
|
||||||
|
// 双击左边区域 👈
|
||||||
|
onDoubleTapSeekBackward();
|
||||||
|
break;
|
||||||
|
case 'center':
|
||||||
|
onDoubleTapCenter();
|
||||||
|
break;
|
||||||
|
case 'right':
|
||||||
|
// 双击右边区域 👈
|
||||||
|
onDoubleTapSeekForward();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -91,6 +122,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
widget.controller.headerControl = widget.headerControl;
|
widget.controller.headerControl = widget.headerControl;
|
||||||
defaultBtmProgressBehavior = setting.get(SettingBoxKey.btmProgressBehavior,
|
defaultBtmProgressBehavior = setting.get(SettingBoxKey.btmProgressBehavior,
|
||||||
defaultValue: BtmProgresBehavior.values.first.code);
|
defaultValue: BtmProgresBehavior.values.first.code);
|
||||||
|
enableQuickDouble =
|
||||||
|
setting.get(SettingBoxKey.enableQuickDouble, defaultValue: true);
|
||||||
|
|
||||||
Future.microtask(() async {
|
Future.microtask(() async {
|
||||||
try {
|
try {
|
||||||
@ -429,19 +462,15 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
final totalWidth = MediaQuery.of(context).size.width;
|
final totalWidth = MediaQuery.of(context).size.width;
|
||||||
final tapPosition = details.localPosition.dx;
|
final tapPosition = details.localPosition.dx;
|
||||||
final sectionWidth = totalWidth / 3;
|
final sectionWidth = totalWidth / 3;
|
||||||
|
String type = 'left';
|
||||||
if (tapPosition < sectionWidth) {
|
if (tapPosition < sectionWidth) {
|
||||||
// 双击左边区域 👈
|
type = 'left';
|
||||||
onDoubleTapSeekBackward();
|
|
||||||
} else if (tapPosition < sectionWidth * 2) {
|
} else if (tapPosition < sectionWidth * 2) {
|
||||||
if (_.playerStatus.status.value == PlayerStatus.playing) {
|
type = 'center';
|
||||||
_.togglePlay();
|
|
||||||
} else {
|
|
||||||
_.play();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// 双击右边区域 👈
|
type = 'right';
|
||||||
onDoubleTapSeekForward();
|
|
||||||
}
|
}
|
||||||
|
doubleTapFuc(type);
|
||||||
},
|
},
|
||||||
onLongPressStart: (detail) {
|
onLongPressStart: (detail) {
|
||||||
feedBack();
|
feedBack();
|
||||||
|
@ -99,6 +99,8 @@ class SettingBoxKey {
|
|||||||
static const String enableAutoBrightness = 'enableAutoBrightness';
|
static const String enableAutoBrightness = 'enableAutoBrightness';
|
||||||
static const String enableAutoEnter = 'enableAutoEnter';
|
static const String enableAutoEnter = 'enableAutoEnter';
|
||||||
static const String enableAutoExit = 'enableAutoExit';
|
static const String enableAutoExit = 'enableAutoExit';
|
||||||
|
// youtube 双击快进快退
|
||||||
|
static const String enableQuickDouble = 'enableQuickDouble';
|
||||||
|
|
||||||
/// 隐私
|
/// 隐私
|
||||||
static const String blackMidsList = 'blackMidsList';
|
static const String blackMidsList = 'blackMidsList';
|
||||||
|
Reference in New Issue
Block a user