fix video progress

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-06-13 10:02:17 +08:00
parent 199ad274b7
commit b02e4253f1
5 changed files with 38 additions and 50 deletions

View File

@@ -736,15 +736,10 @@ class VideoDetailController extends GetxController
}
Future<void> playerInit({
String? video,
String? audio,
Duration? seekToTime,
Duration? duration,
bool? autoplay,
Volume? volume,
bool autoFullScreenFlag = false,
}) async {
Duration? seek = seekToTime ?? defaultST ?? playedTime;
Duration? seek = defaultST ?? playedTime;
if (seek == null || seek == Duration.zero) {
seek = getFirstSegment();
}
@@ -757,15 +752,13 @@ class VideoDetailController extends GetxController
hasDashAudio: entry.hasDashAudio,
)
: NetworkSource(
videoSource: video ?? videoUrl!,
audioSource: audio ?? audioUrl,
videoSource: videoUrl!,
audioSource: audioUrl,
),
seekTo: seek,
duration:
duration ??
(data.timeLength == null
? null
: Duration(milliseconds: data.timeLength!)),
duration: data.timeLength == null
? null
: Duration(milliseconds: data.timeLength!),
isVertical: isVertical.value,
aid: aid,
bvid: bvid,
@@ -781,7 +774,7 @@ class VideoDetailController extends GetxController
},
width: firstVideo.width,
height: firstVideo.height,
volume: volume ?? this.volume,
volume: volume,
autoFullScreenFlag: autoFullScreenFlag,
);
@@ -815,14 +808,13 @@ class VideoDetailController extends GetxController
return;
}
currLang.value = language;
queryVideoUrl(defaultST: playedTime);
queryVideoUrl(fromReset: true);
}
Volume? volume;
// 视频链接
Future<void> queryVideoUrl({
Duration? defaultST,
bool fromReset = false,
bool autoFullScreenFlag = false,
}) async {
@@ -866,11 +858,13 @@ class VideoDetailController extends GetxController
volume = data.volume;
final progress = args.remove('progress');
if (progress != null) {
this.defaultST = Duration(milliseconds: progress);
} else if (defaultST == null && data.lastPlayTime != null) {
this.defaultST = Duration(milliseconds: data.lastPlayTime!);
if (!fromReset) {
final progress = args.remove('progress');
if (progress != null) {
defaultST = Duration(milliseconds: progress);
} else {
defaultST = Duration(milliseconds: data.lastPlayTime);
}
}
if (!isUgc && !fromReset && plPlayerController.enablePgcSkip) {