mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-20 17:30:13 +08:00
@@ -247,19 +247,15 @@ abstract final class VideoHttp {
|
||||
|
||||
case .pgc:
|
||||
final result = res.data['result'];
|
||||
data = PlayUrlModel.fromJson(result['video_info']);
|
||||
if (result['play_view_business_info']?['user_status']?['watch_progress']?['current_watch_progress']
|
||||
case final int progress when progress > 0) {
|
||||
data.lastPlayTime = progress;
|
||||
}
|
||||
data = PlayUrlModel.fromJson(result['video_info'])
|
||||
..lastPlayTime =
|
||||
result['play_view_business_info']?['user_status']?['watch_progress']?['current_watch_progress'];
|
||||
|
||||
case .pugv:
|
||||
final result = res.data['data'];
|
||||
data = PlayUrlModel.fromJson(result);
|
||||
if (result['play_view_business_info']?['user_status']?['watch_progress']?['current_watch_progress']
|
||||
case final int progress when progress > 0) {
|
||||
data.lastPlayTime = progress;
|
||||
}
|
||||
data = PlayUrlModel.fromJson(result)
|
||||
..lastPlayTime =
|
||||
result['play_view_business_info']?['user_status']?['watch_progress']?['current_watch_progress'];
|
||||
}
|
||||
return Success(data);
|
||||
} else if (epid != null && videoType == .ugc) {
|
||||
|
||||
@@ -22,7 +22,7 @@ class PlayUrlModel {
|
||||
this.seekType,
|
||||
this.dash,
|
||||
this.supportFormats,
|
||||
this.lastPlayTime,
|
||||
this._lastPlayTime = 0,
|
||||
this.lastPlayCid,
|
||||
});
|
||||
|
||||
@@ -42,7 +42,17 @@ class PlayUrlModel {
|
||||
List<Durl>? durl;
|
||||
List<FormatItem>? supportFormats;
|
||||
Volume? volume;
|
||||
int? lastPlayTime;
|
||||
|
||||
late int _lastPlayTime;
|
||||
int get lastPlayTime => _lastPlayTime;
|
||||
set lastPlayTime(int? value) {
|
||||
if (value != null && value > 0) {
|
||||
_lastPlayTime = value;
|
||||
} else {
|
||||
_lastPlayTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int? lastPlayCid;
|
||||
String? curLanguage;
|
||||
Language? language;
|
||||
@@ -69,9 +79,7 @@ class PlayUrlModel {
|
||||
?.map<FormatItem>((e) => FormatItem.fromJson(e))
|
||||
.toList();
|
||||
volume = json['volume'] == null ? null : Volume.fromJson(json['volume']);
|
||||
if (json['last_play_time'] case final int progress when progress > 0) {
|
||||
lastPlayTime = progress;
|
||||
}
|
||||
lastPlayTime = json['last_play_time'];
|
||||
lastPlayCid = json['last_play_cid'];
|
||||
curLanguage = json['cur_language'];
|
||||
language = json['language'] == null
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -79,11 +79,7 @@ class VideoDetailPageV extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
with
|
||||
TickerProviderStateMixin,
|
||||
RouteAware,
|
||||
RouteAwareMixin,
|
||||
WidgetsBindingObserver {
|
||||
with RouteAware, RouteAwareMixin, WidgetsBindingObserver {
|
||||
final heroTag = Get.arguments['heroTag'];
|
||||
|
||||
late final VideoDetailController videoDetailController;
|
||||
@@ -1360,7 +1356,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
if (videoDetailController.tabCtr.length != tabs.length) {
|
||||
videoDetailController.tabCtr.dispose();
|
||||
videoDetailController.tabCtr = TabController(
|
||||
vsync: this,
|
||||
vsync: videoDetailController,
|
||||
length: tabs.length,
|
||||
initialIndex: tabs.isEmpty
|
||||
? 0
|
||||
|
||||
@@ -449,10 +449,7 @@ class HeaderControlState extends State<HeaderControl>
|
||||
dense: true,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
videoDetailCtr.queryVideoUrl(
|
||||
defaultST: videoDetailCtr.playedTime,
|
||||
fromReset: true,
|
||||
);
|
||||
videoDetailCtr.queryVideoUrl(fromReset: true);
|
||||
},
|
||||
leading: const Icon(Icons.refresh_outlined, size: 20),
|
||||
title: const Text('重载视频', style: titleStyle),
|
||||
@@ -518,10 +515,7 @@ class HeaderControlState extends State<HeaderControl>
|
||||
VideoUtils.cdnService = result;
|
||||
setting.put(SettingBoxKey.CDNService, result.name);
|
||||
SmartDialog.showToast('已设置为 ${result.desc},正在重载视频');
|
||||
videoDetailCtr.queryVideoUrl(
|
||||
defaultST: videoDetailCtr.playedTime,
|
||||
fromReset: true,
|
||||
);
|
||||
videoDetailCtr.queryVideoUrl(fromReset: true);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user