mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
mod: fullscreen debounce
Closes #340 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1370,49 +1370,52 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 全屏
|
// 全屏
|
||||||
Future<void> triggerFullScreen({bool status = true}) async {
|
void triggerFullScreen({bool status = true, int duration = 500}) {
|
||||||
stopScreenTimer();
|
EasyThrottle.throttle('fullScreen', Duration(milliseconds: duration),
|
||||||
FullScreenMode mode = FullScreenModeCode.fromCode(
|
() async {
|
||||||
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!;
|
stopScreenTimer();
|
||||||
bool removeSafeArea = setting.get(SettingBoxKey.videoPlayerRemoveSafeArea,
|
FullScreenMode mode = FullScreenModeCode.fromCode(
|
||||||
defaultValue: false);
|
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!;
|
||||||
if (!isFullScreen.value && status) {
|
bool removeSafeArea = setting.get(SettingBoxKey.videoPlayerRemoveSafeArea,
|
||||||
// StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE);
|
defaultValue: false);
|
||||||
hideStatusBar();
|
if (!isFullScreen.value && status) {
|
||||||
|
// StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE);
|
||||||
|
hideStatusBar();
|
||||||
|
|
||||||
/// 按照视频宽高比决定全屏方向
|
/// 按照视频宽高比决定全屏方向
|
||||||
toggleFullScreen(true);
|
toggleFullScreen(true);
|
||||||
|
|
||||||
/// 进入全屏
|
/// 进入全屏
|
||||||
if (mode == FullScreenMode.none) {
|
if (mode == FullScreenMode.none) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if (mode == FullScreenMode.gravity) {
|
||||||
|
fullAutoModeForceSensor();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mode == FullScreenMode.vertical ||
|
||||||
|
(mode == FullScreenMode.auto && direction.value == 'vertical') ||
|
||||||
|
(mode == FullScreenMode.ratio &&
|
||||||
|
(Get.height / Get.width < 1.25 ||
|
||||||
|
direction.value == 'vertical'))) {
|
||||||
|
await verticalScreenForTwoSeconds();
|
||||||
|
} else {
|
||||||
|
await landScape();
|
||||||
|
}
|
||||||
|
} else if (isFullScreen.value && !status) {
|
||||||
|
// StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
||||||
|
if (!removeSafeArea) showStatusBar();
|
||||||
|
toggleFullScreen(false);
|
||||||
|
if (mode == FullScreenMode.none) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||||
|
await verticalScreenForTwoSeconds();
|
||||||
|
} else {
|
||||||
|
await autoScreen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mode == FullScreenMode.gravity) {
|
});
|
||||||
fullAutoModeForceSensor();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mode == FullScreenMode.vertical ||
|
|
||||||
(mode == FullScreenMode.auto && direction.value == 'vertical') ||
|
|
||||||
(mode == FullScreenMode.ratio &&
|
|
||||||
(Get.height / Get.width < 1.25 ||
|
|
||||||
direction.value == 'vertical'))) {
|
|
||||||
await verticalScreenForTwoSeconds();
|
|
||||||
} else {
|
|
||||||
await landScape();
|
|
||||||
}
|
|
||||||
} else if (isFullScreen.value && !status) {
|
|
||||||
// StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
|
||||||
if (!removeSafeArea) showStatusBar();
|
|
||||||
toggleFullScreen(false);
|
|
||||||
if (mode == FullScreenMode.none) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
|
||||||
await verticalScreenForTwoSeconds();
|
|
||||||
} else {
|
|
||||||
await autoScreen();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPositionListener(Function(Duration position) listener) =>
|
void addPositionListener(Function(Duration position) listener) =>
|
||||||
|
|||||||
@@ -629,8 +629,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
size: 24,
|
size: 24,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
fuc: () =>
|
fuc: () => plPlayerController.triggerFullScreen(
|
||||||
plPlayerController.triggerFullScreen(status: !isFullScreen),
|
status: !isFullScreen, duration: 800),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -842,11 +842,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
details.localFocalPoint.dy - _initialFocalPoint.dy;
|
details.localFocalPoint.dy - _initialFocalPoint.dy;
|
||||||
|
|
||||||
void fullScreenTrigger(bool status) {
|
void fullScreenTrigger(bool status) {
|
||||||
EasyThrottle.throttle(
|
plPlayerController.triggerFullScreen(
|
||||||
'fullScreen', const Duration(milliseconds: 800),
|
status: status, duration: 800);
|
||||||
() async {
|
|
||||||
await plPlayerController.triggerFullScreen(status: status);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cumulativeDy > threshold) {
|
if (cumulativeDy > threshold) {
|
||||||
@@ -1170,12 +1167,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
details.localPosition.dy - _initialFocalPoint.dy;
|
details.localPosition.dy - _initialFocalPoint.dy;
|
||||||
|
|
||||||
void fullScreenTrigger(bool status) {
|
void fullScreenTrigger(bool status) {
|
||||||
EasyThrottle.throttle(
|
plPlayerController.triggerFullScreen(status: status);
|
||||||
'fullScreen', const Duration(milliseconds: 800),
|
|
||||||
() async {
|
|
||||||
await plPlayerController.triggerFullScreen(
|
|
||||||
status: status);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cumulativeDy > threshold) {
|
if (cumulativeDy > threshold) {
|
||||||
|
|||||||
Reference in New Issue
Block a user