mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-26 05:20:09 +08:00
fix: resume history from the recording account progress (#2458)
This commit is contained in:
@@ -21,6 +21,18 @@ class HistoryItemModel with MultiSelectData {
|
|||||||
String? tagName;
|
String? tagName;
|
||||||
int? liveStatus;
|
int? liveStatus;
|
||||||
|
|
||||||
|
/// The history API uses seconds as the progress unit
|
||||||
|
/// while the player expects milliseconds.
|
||||||
|
///
|
||||||
|
/// The history API uses `-1` to indicate that the video has been fully watched.
|
||||||
|
/// When reopened, playback should start from the beginning to avoid resuming from
|
||||||
|
/// the last playback position associated with the video streaming account.
|
||||||
|
int? get playbackProgress {
|
||||||
|
final progress = this.progress;
|
||||||
|
if (progress == null) return null;
|
||||||
|
return progress == -1 ? 0 : progress * Duration.millisecondsPerSecond;
|
||||||
|
}
|
||||||
|
|
||||||
HistoryItemModel({
|
HistoryItemModel({
|
||||||
this.title,
|
this.title,
|
||||||
this.cover,
|
this.cover,
|
||||||
|
|||||||
@@ -69,13 +69,17 @@ class HistoryItem extends StatelessWidget {
|
|||||||
SmartDialog.showToast('直播未开播');
|
SmartDialog.showToast('直播未开播');
|
||||||
}
|
}
|
||||||
} else if (business == 'pgc') {
|
} else if (business == 'pgc') {
|
||||||
PageUtils.viewPgc(epId: item.history.epid);
|
PageUtils.viewPgc(
|
||||||
|
epId: item.history.epid,
|
||||||
|
progress: item.playbackProgress,
|
||||||
|
);
|
||||||
} else if (business == 'cheese') {
|
} else if (business == 'cheese') {
|
||||||
if (item.uri?.isNotEmpty == true) {
|
if (item.uri?.isNotEmpty == true) {
|
||||||
PageUtils.viewPgcFromUri(
|
PageUtils.viewPgcFromUri(
|
||||||
item.uri!,
|
item.uri!,
|
||||||
isPgc: false,
|
isPgc: false,
|
||||||
aid: item.history.oid,
|
aid: item.history.oid,
|
||||||
|
progress: item.playbackProgress,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -101,6 +105,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
cover: item.cover,
|
cover: item.cover,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
dimension: dimension,
|
dimension: dimension,
|
||||||
|
progress: item.playbackProgress,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -624,6 +624,7 @@ abstract final class PageUtils {
|
|||||||
seasonId: isSeason ? id : null,
|
seasonId: isSeason ? id : null,
|
||||||
epId: isSeason ? null : id,
|
epId: isSeason ? null : id,
|
||||||
aid: aid,
|
aid: aid,
|
||||||
|
progress: progress,
|
||||||
off: off,
|
off: off,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -752,6 +753,7 @@ abstract final class PageUtils {
|
|||||||
dynamic seasonId,
|
dynamic seasonId,
|
||||||
dynamic epId,
|
dynamic epId,
|
||||||
int? aid,
|
int? aid,
|
||||||
|
int? progress, // milliseconds
|
||||||
bool off = false,
|
bool off = false,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
@@ -777,6 +779,7 @@ abstract final class PageUtils {
|
|||||||
seasonId: response.seasonId,
|
seasonId: response.seasonId,
|
||||||
epId: episode.id,
|
epId: episode.id,
|
||||||
cover: episode.cover,
|
cover: episode.cover,
|
||||||
|
progress: progress,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'pgcItem': response,
|
'pgcItem': response,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user