Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/http/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'package:PiliPlus/models_new/video/video_note_list/data.dart';
import 'package:PiliPlus/models_new/video/video_play_info/data.dart';
import 'package:PiliPlus/models_new/video/video_relation/data.dart';
import 'package:PiliPlus/utils/accounts.dart';
import 'package:PiliPlus/utils/accounts/account.dart';
import 'package:PiliPlus/utils/app_sign.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/global_data.dart';
Expand Down Expand Up @@ -200,6 +201,7 @@ class VideoHttp {
required bool tryLook,
required VideoType videoType,
String? language,
Account? account,
}) async {
final params = await WbiSign.makSign({
'avid': ?avid,
Expand All @@ -225,6 +227,7 @@ class VideoHttp {
var res = await Request().get(
videoType.api,
queryParameters: params,
options: Options(extra: {'account': account}),
);

if (res.data['code'] == 0) {
Expand Down Expand Up @@ -257,6 +260,7 @@ class VideoHttp {
seasonId: seasonId,
tryLook: tryLook,
videoType: VideoType.pgc,
account: account,
);
}
return Error(_parseVideoErr(res.data['code'], res.data['message']));
Expand Down
17 changes: 11 additions & 6 deletions lib/pages/video/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,7 @@ class VideoDetailController extends GetxController
tryLook: plPlayerController.tryLook,
videoType: _actualVideoType ?? videoType,
language: currLang.value,
account: Accounts.history,
);

if (result.isSuccess) {
Expand All @@ -1267,12 +1268,16 @@ class VideoDetailController extends GetxController
if (progress != null) {
this.defaultST = Duration(milliseconds: progress);
args['progress'] = null;
} else {
this.defaultST =
defaultST ??
(data.lastPlayTime == null
? Duration.zero
: Duration(milliseconds: data.lastPlayTime!));
} else if (defaultST == null) {
if (data.lastPlayTime != null &&
data.timeLength != null &&
data.lastPlayTime! >= data.timeLength! - 400) {
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition for determining if a video should restart from the beginning only checks if lastPlayTime >= timeLength - 400. However, lastPlayTime and timeLength are in milliseconds, so the 400ms threshold might be too small. Consider if this should be a larger value (e.g., 1000-5000ms) to provide a better user experience, as users who stopped within the last 400ms of a video might prefer to resume rather than restart.

Suggested change
data.lastPlayTime! >= data.timeLength! - 400) {
data.lastPlayTime! >= data.timeLength! - 3000) {

Copilot uses AI. Check for mistakes.
this.defaultST = Duration.zero;
} else {
this.defaultST = data.lastPlayTime != null
? Duration(milliseconds: data.lastPlayTime!)
: Duration.zero;
}
}

if (!isUgc && !fromReset && plPlayerController.enablePgcSkip) {
Expand Down