mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
fix: video duration
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1359,7 +1359,8 @@ class VideoDetailController extends GetxController
|
|||||||
duration += split[i] * pow(60, i).toInt();
|
duration += split[i] * pow(60, i).toInt();
|
||||||
}
|
}
|
||||||
if (duration <=
|
if (duration <=
|
||||||
plPlayerController.durationSeconds.value) {
|
plPlayerController
|
||||||
|
.durationSeconds.value.inSeconds) {
|
||||||
setState(() {
|
setState(() {
|
||||||
updateSegment(
|
updateSegment(
|
||||||
isFirst: isFirst,
|
isFirst: isFirst,
|
||||||
@@ -1687,7 +1688,9 @@ class VideoDetailController extends GetxController
|
|||||||
'userID': GStorage.blockUserID,
|
'userID': GStorage.blockUserID,
|
||||||
'userAgent': Constants.userAgent,
|
'userAgent': Constants.userAgent,
|
||||||
'videoDuration': plPlayerController
|
'videoDuration': plPlayerController
|
||||||
.durationSeconds.value,
|
.durationSeconds
|
||||||
|
.value
|
||||||
|
.inSeconds,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
'segments': list!
|
'segments': list!
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class PlPlayerController {
|
|||||||
// 展示使用
|
// 展示使用
|
||||||
final Rx<Duration> _sliderTempPosition = Rx(Duration.zero);
|
final Rx<Duration> _sliderTempPosition = Rx(Duration.zero);
|
||||||
final Rx<Duration> _duration = Rx(Duration.zero);
|
final Rx<Duration> _duration = Rx(Duration.zero);
|
||||||
final RxInt durationSeconds = 0.obs;
|
final Rx<Duration> durationSeconds = Duration.zero.obs;
|
||||||
final Rx<Duration> _buffered = Rx(Duration.zero);
|
final Rx<Duration> _buffered = Rx(Duration.zero);
|
||||||
final RxInt bufferedSeconds = 0.obs;
|
final RxInt bufferedSeconds = 0.obs;
|
||||||
|
|
||||||
@@ -330,9 +330,8 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateDurationSecond() {
|
void updateDurationSecond() {
|
||||||
int newSecond = _duration.value.inSeconds;
|
if (durationSeconds.value != _duration.value) {
|
||||||
if (durationSeconds.value != newSecond) {
|
durationSeconds.value = _duration.value;
|
||||||
durationSeconds.value = newSecond;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1437,7 +1436,7 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
bool isComplete = playerStatus.status.value == PlayerStatus.completed ||
|
bool isComplete = playerStatus.status.value == PlayerStatus.completed ||
|
||||||
type == 'completed';
|
type == 'completed';
|
||||||
if ((duration.value - position.value).inMilliseconds > 1000) {
|
if ((durationSeconds.value - position.value).inMilliseconds > 1000) {
|
||||||
isComplete = false;
|
isComplete = false;
|
||||||
}
|
}
|
||||||
// 播放状态变化时,更新
|
// 播放状态变化时,更新
|
||||||
|
|||||||
@@ -321,7 +321,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
}),
|
}),
|
||||||
Obx(
|
Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
Utils.timeFormat(plPlayerController.durationSeconds.value),
|
Utils.timeFormat(
|
||||||
|
plPlayerController.durationSeconds.value.inSeconds),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Color(0xFFD0D0D0),
|
color: Color(0xFFD0D0D0),
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
@@ -329,7 +330,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
fontFeatures: [FontFeature.tabularFigures()],
|
fontFeatures: [FontFeature.tabularFigures()],
|
||||||
),
|
),
|
||||||
semanticsLabel:
|
semanticsLabel:
|
||||||
'共${Utils.durationReadFormat(Utils.timeFormat(plPlayerController.durationSeconds.value))}',
|
'共${Utils.durationReadFormat(Utils.timeFormat(plPlayerController.durationSeconds.value.inSeconds))}',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -702,7 +703,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
if (plPlayerController.showSeekPreview) {
|
if (plPlayerController.showSeekPreview) {
|
||||||
try {
|
try {
|
||||||
plPlayerController.previewDx.value = result.inMilliseconds /
|
plPlayerController.previewDx.value = result.inMilliseconds /
|
||||||
plPlayerController.duration.value.inMilliseconds *
|
plPlayerController
|
||||||
|
.durationSeconds.value.inMilliseconds *
|
||||||
context.size!.width;
|
context.size!.width;
|
||||||
if (plPlayerController.showPreview.value.not) {
|
if (plPlayerController.showPreview.value.not) {
|
||||||
plPlayerController.showPreview.value = true;
|
plPlayerController.showPreview.value = true;
|
||||||
@@ -856,11 +858,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
const SizedBox(width: 2),
|
const SizedBox(width: 2),
|
||||||
Obx(
|
Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
plPlayerController.duration.value.inMinutes >= 60
|
plPlayerController
|
||||||
|
.durationSeconds.value.inMinutes >=
|
||||||
|
60
|
||||||
? printDurationWithHours(
|
? printDurationWithHours(
|
||||||
plPlayerController.duration.value)
|
plPlayerController.durationSeconds.value)
|
||||||
: printDuration(
|
: printDuration(
|
||||||
plPlayerController.duration.value),
|
plPlayerController.durationSeconds.value),
|
||||||
style: textStyle,
|
style: textStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1071,7 +1075,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
Obx(
|
Obx(
|
||||||
() {
|
() {
|
||||||
final int value = plPlayerController.sliderPositionSeconds.value;
|
final int value = plPlayerController.sliderPositionSeconds.value;
|
||||||
final int max = plPlayerController.durationSeconds.value;
|
final int max = plPlayerController.durationSeconds.value.inSeconds;
|
||||||
final int buffer = plPlayerController.bufferedSeconds.value;
|
final int buffer = plPlayerController.bufferedSeconds.value;
|
||||||
if (plPlayerController.showControls.value) {
|
if (plPlayerController.showControls.value) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
Obx(
|
Obx(
|
||||||
() {
|
() {
|
||||||
final int value = controller!.sliderPositionSeconds.value;
|
final int value = controller!.sliderPositionSeconds.value;
|
||||||
final int max = controller!.durationSeconds.value;
|
final int max = controller!.durationSeconds.value.inSeconds;
|
||||||
final int buffer = controller!.bufferedSeconds.value;
|
final int buffer = controller!.bufferedSeconds.value;
|
||||||
if (value > max || max <= 0) {
|
if (value > max || max <= 0) {
|
||||||
return nil;
|
return nil;
|
||||||
|
|||||||
Reference in New Issue
Block a user