opt video action

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-19 18:17:04 +08:00
parent 4f2bfb8126
commit 6c8baa5be5

View File

@@ -1010,6 +1010,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
color: Colors.white,
fontSize: 12,
);
final isLive = plPlayerController.isLive;
return Stack(
fit: StackFit.passthrough,
@@ -1028,8 +1029,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
!plPlayerController.continuePlayInBackground.value,
resumeUponEnteringForegroundMode: true,
// 字幕尺寸调节
subtitleViewConfiguration:
plPlayerController.subtitleConfig.value,
subtitleViewConfiguration: isLive
? const SubtitleViewConfiguration()
: plPlayerController.subtitleConfig.value,
fit: videoFit.boxFit,
aspectRatio: videoFit.aspectRatio,
dmWidget: widget.danmuWidget,
@@ -1047,10 +1049,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
onTap: () => plPlayerController.controls =
!plPlayerController.showControls.value,
onDoubleTapDown: onDoubleTapDown,
onLongPressStart: (_) =>
plPlayerController.setLongPressStatus(true),
onLongPressEnd: (_) =>
plPlayerController.setLongPressStatus(false),
onLongPressStart: isLive
? null
: (_) => plPlayerController.setLongPressStatus(true),
onLongPressEnd: isLive
? null
: (_) => plPlayerController.setLongPressStatus(false),
enableDragSubtitle: plPlayerController.enableDragSubtitle,
onUpdatePadding: plPlayerController.onUpdatePadding,
);
@@ -1062,6 +1066,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
// Positioned.fill(top: 4, child: widget.danmuWidget!),
/// 长按倍速 toast
if (!isLive)
IgnorePointer(
ignoring: true,
child: Align(
@@ -1073,7 +1078,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: Obx(
() => AnimatedOpacity(
curve: Curves.easeInOut,
opacity: plPlayerController.longPressStatus.value ? 1.0 : 0.0,
opacity: plPlayerController.longPressStatus.value
? 1.0
: 0.0,
duration: const Duration(milliseconds: 150),
child: Container(
padding: const EdgeInsets.all(6),
@@ -1098,6 +1105,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
),
/// 时间进度 toast
if (!isLive)
IgnorePointer(
ignoring: true,
child: Align(
@@ -1109,7 +1117,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: Obx(
() => AnimatedOpacity(
curve: Curves.easeInOut,
opacity: plPlayerController.isSliderMoving.value ? 1.0 : 0.0,
opacity: plPlayerController.isSliderMoving.value
? 1.0
: 0.0,
duration: const Duration(milliseconds: 150),
child: Container(
decoration: const BoxDecoration(
@@ -1350,7 +1360,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
),
/// 进度条 live模式下禁用
if (!plPlayerController.isLive &&
if (!isLive &&
plPlayerController.progressType != BtmProgressBehavior.alwaysHide)
Positioned(
bottom: -2.2,
@@ -1453,7 +1463,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
),
),
if (!plPlayerController.isLive && plPlayerController.showSeekPreview)
if (!isLive && plPlayerController.showSeekPreview)
buildSeekPreviewWidget(
plPlayerController,
maxWidth,
@@ -1461,10 +1471,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
),
// 锁
if (!isLive)
SafeArea(
child: Obx(
() => Visibility(
visible: !plPlayerController.isLive && isFullScreen,
visible: isFullScreen,
child: Align(
alignment: Alignment.centerLeft,
child: FractionalTranslation(
@@ -1472,7 +1483,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: Visibility(
visible:
plPlayerController.showControls.value &&
(isFullScreen || plPlayerController.controlsLock.value),
(isFullScreen ||
plPlayerController.controlsLock.value),
child: DecoratedBox(
decoration: const BoxDecoration(
color: Color(0x45000000),
@@ -1647,8 +1659,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
}),
/// 点击 快进/快退
if (!isLive)
Obx(
() => _mountSeekBackwardButton.value || _mountSeekForwardButton.value
() =>
_mountSeekBackwardButton.value || _mountSeekForwardButton.value
? Positioned.fill(
child: Row(
children: [
@@ -1669,7 +1683,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final Player player = widget
.plPlayerController
.videoPlayerController!;
Duration result = player.state.position - value;
Duration result =
player.state.position - value;
result = result.clamp(
Duration.zero,
player.state.duration,
@@ -1699,7 +1714,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final Player player = widget
.plPlayerController
.videoPlayerController!;
Duration result = player.state.position + value;
Duration result =
player.state.position + value;
result = result.clamp(
Duration.zero,
player.state.duration,