mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
opt: PlPlayerController (#1832)
* opt: audio uri * opt: PlPlayerController
This commit is contained in:
committed by
GitHub
parent
ed2bd069ee
commit
9411785d26
@@ -400,7 +400,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
Obx(
|
||||
() => Text(
|
||||
DurationUtils.formatDuration(
|
||||
plPlayerController.durationSeconds.value.inSeconds,
|
||||
plPlayerController.duration.value.inSeconds,
|
||||
),
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFD0D0D0),
|
||||
@@ -1016,15 +1016,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
if (plPlayerController.isLive) return;
|
||||
|
||||
final int curSliderPosition =
|
||||
plPlayerController.sliderPosition.value.inMilliseconds;
|
||||
plPlayerController.sliderPosition.inMilliseconds;
|
||||
final int newPos =
|
||||
(curSliderPosition +
|
||||
(plPlayerController.sliderScale * delta.dx / maxWidth)
|
||||
.round())
|
||||
.clamp(
|
||||
0,
|
||||
plPlayerController.duration.value.inMilliseconds,
|
||||
);
|
||||
.clamp(0, plPlayerController.duration.value.inMilliseconds);
|
||||
final Duration result = Duration(milliseconds: newPos);
|
||||
final height = maxHeight * 0.125;
|
||||
if (details.localFocalPoint.dy <= height &&
|
||||
@@ -1133,11 +1130,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
if (plPlayerController.isSliderMoving.value) {
|
||||
if (plPlayerController.cancelSeek == true) {
|
||||
plPlayerController.onUpdatedSliderProgress(
|
||||
plPlayerController.position.value,
|
||||
plPlayerController.position,
|
||||
);
|
||||
} else {
|
||||
plPlayerController.seekTo(
|
||||
plPlayerController.sliderPosition.value,
|
||||
plPlayerController.sliderPosition,
|
||||
isSeek: false,
|
||||
);
|
||||
}
|
||||
@@ -1308,15 +1305,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
Offset delta = event.localPanDelta;
|
||||
final int curSliderPosition =
|
||||
plPlayerController.sliderPosition.value.inMilliseconds;
|
||||
plPlayerController.sliderPosition.inMilliseconds;
|
||||
final int newPos =
|
||||
(curSliderPosition +
|
||||
(plPlayerController.sliderScale * delta.dx / maxWidth)
|
||||
.round())
|
||||
.clamp(
|
||||
0,
|
||||
plPlayerController.duration.value.inMilliseconds,
|
||||
);
|
||||
.clamp(0, plPlayerController.duration.value.inMilliseconds);
|
||||
final Duration result = Duration(milliseconds: newPos);
|
||||
if (plPlayerController.cancelSeek == true) {
|
||||
plPlayerController
|
||||
@@ -1504,10 +1498,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
() {
|
||||
return Text(
|
||||
DurationUtils.formatDuration(
|
||||
plPlayerController
|
||||
.durationSeconds
|
||||
.value
|
||||
.inSeconds,
|
||||
plPlayerController.duration.value.inSeconds,
|
||||
),
|
||||
style: textStyle,
|
||||
);
|
||||
@@ -1754,7 +1745,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final int value =
|
||||
plPlayerController.sliderPositionSeconds.value;
|
||||
final int max =
|
||||
plPlayerController.durationSeconds.value.inSeconds;
|
||||
plPlayerController.duration.value.inSeconds;
|
||||
final int buffer =
|
||||
plPlayerController.bufferedSeconds.value;
|
||||
return ProgressBar(
|
||||
@@ -1923,8 +1914,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
if (plPlayerController.isBuffering.value)
|
||||
Obx(() {
|
||||
if (plPlayerController.buffered.value ==
|
||||
Duration.zero) {
|
||||
if (plPlayerController.bufferedSeconds.value == 0) {
|
||||
return const Text(
|
||||
'加载中...',
|
||||
style: TextStyle(
|
||||
@@ -2088,8 +2078,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
|
||||
late final segment = Pair(
|
||||
first: plPlayerController.position.value.inMilliseconds / 1000.0,
|
||||
second: plPlayerController.position.value.inMilliseconds / 1000.0,
|
||||
first: plPlayerController.position.inMilliseconds / 1000.0,
|
||||
second: plPlayerController.position.inMilliseconds / 1000.0,
|
||||
);
|
||||
|
||||
Future<void> screenshotWebp() async {
|
||||
@@ -2103,8 +2093,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
final ctr = plPlayerController;
|
||||
final theme = Theme.of(context);
|
||||
final currentPos = ctr.position.value.inMilliseconds / 1000.0;
|
||||
final duration = ctr.durationSeconds.value.inMilliseconds / 1000.0;
|
||||
final currentPos = ctr.position.inMilliseconds / 1000.0;
|
||||
final duration = ctr.duration.value.inMilliseconds / 1000.0;
|
||||
final model = PostSegmentModel(
|
||||
segment: segment,
|
||||
category: SegmentType.sponsor,
|
||||
|
||||
Reference in New Issue
Block a user