Closes #1680

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-24 12:12:56 +08:00
parent bbcf0dec1b
commit 4256c2b023
5 changed files with 98 additions and 149 deletions

View File

@@ -1256,18 +1256,20 @@ class PlPlayerController {
}
await _videoPlayerController?.setRate(speed);
if (danmakuController != null) {
DanmakuOption currentOption = danmakuController!.option;
double defaultDuration = currentOption.duration * lastPlaybackSpeed;
double defaultStaticDuration =
currentOption.staticDuration * lastPlaybackSpeed;
DanmakuOption updatedOption = currentOption.copyWith(
duration: defaultDuration / speed,
staticDuration: defaultStaticDuration / speed,
);
danmakuController!.updateOption(updatedOption);
}
_playbackSpeed.value = speed;
if (danmakuController != null) {
try {
DanmakuOption currentOption = danmakuController!.option;
double defaultDuration = currentOption.duration * lastPlaybackSpeed;
double defaultStaticDuration =
currentOption.staticDuration * lastPlaybackSpeed;
DanmakuOption updatedOption = currentOption.copyWith(
duration: defaultDuration / speed,
staticDuration: defaultStaticDuration / speed,
);
danmakuController!.updateOption(updatedOption);
} catch (_) {}
}
}
// 还原默认速度
@@ -1591,7 +1593,7 @@ class PlPlayerController {
if ((mode == FullScreenMode.vertical ||
(mode == FullScreenMode.auto && isVertical) ||
(mode == FullScreenMode.ratio &&
(isVertical || size.height / size.width < 1.25)))) {
(isVertical || size.height / size.width < kScreenRatio)))) {
await verticalScreenForTwoSeconds();
} else {
await landscape();
@@ -1740,10 +1742,10 @@ class PlPlayerController {
}
return;
}
_playerCount = 0;
disableAutoEnterPip();
setPlayCallBack(null);
dmState.clear();
_playerCount = 0;
_clearPreview();
Utils.channel.setMethodCallHandler(null);
_timer?.cancel();

View File

@@ -1,3 +1,5 @@
const double kScreenRatio = 1.2;
// 全屏模式
enum FullScreenMode {
// 根据内容自适应
@@ -8,8 +10,8 @@ enum FullScreenMode {
vertical('强制竖屏'),
// 始终横屏
horizontal('强制横屏'),
// 屏幕长宽比<1.25或为竖屏视频时竖屏,否则横屏
ratio('屏幕长宽比<1.25或为竖屏视频时竖屏,否则横屏'),
// 屏幕长宽比 < kScreenRatio 或为竖屏视频时竖屏,否则横屏
ratio('屏幕长宽比<$kScreenRatio或为竖屏视频时竖屏,否则横屏'),
// 强制重力转屏(仅安卓)
gravity('忽略系统方向锁定,强制按重力转屏(仅安卓)');

View File

@@ -1185,7 +1185,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
)
..onLongPressStart = ((_) =>
plPlayerController.setLongPressStatus(true))
..onLongPressEnd = (_) => plPlayerController.setLongPressStatus(false);
..onLongPressEnd = ((_) => plPlayerController.setLongPressStatus(false))
..onLongPressCancel = (() =>
plPlayerController.setLongPressStatus(false));
late final OneSequenceGestureRecognizer _tapGestureRecognizer;
late final DoubleTapGestureRecognizer _doubleTapGestureRecognizer;
StreamSubscription<bool>? _danmakuListener;