mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-13 12:50:10 +08:00
refa: cdn (#1743)
* refa: cdn * feat: live cdn (WIP) * tweaks Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * add live quality [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * mod: replace durl host * tweak [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
e589f27195
commit
27ae296b28
@@ -1125,7 +1125,7 @@ class VideoDetailController extends GetxController
|
||||
currentDecodeFormats = VideoDecodeFormatType.fromString(video.codecs!);
|
||||
}
|
||||
firstVideo = video;
|
||||
videoUrl = VideoUtils.getCdnUrl(firstVideo);
|
||||
videoUrl = VideoUtils.getCdnUrl(firstVideo.playUrls);
|
||||
|
||||
/// 根据currentAudioQa 重新设置audioUrl
|
||||
if (currentAudioQa != null) {
|
||||
@@ -1133,7 +1133,7 @@ class VideoDetailController extends GetxController
|
||||
(i) => i.id == currentAudioQa!.code,
|
||||
orElse: () => data.dash!.audio!.first,
|
||||
);
|
||||
audioUrl = VideoUtils.getCdnUrl(firstAudio);
|
||||
audioUrl = VideoUtils.getCdnUrl(firstAudio.playUrls, isAudio: true);
|
||||
}
|
||||
|
||||
playerInit();
|
||||
@@ -1308,7 +1308,7 @@ class VideoDetailController extends GetxController
|
||||
}
|
||||
if (data.dash == null && data.durl != null) {
|
||||
final first = data.durl!.first;
|
||||
videoUrl = first.backupUrl?.lastOrNull ?? first.url!;
|
||||
videoUrl = VideoUtils.getCdnUrl(first.playUrls);
|
||||
audioUrl = '';
|
||||
|
||||
// 实际为FLV/MP4格式,但已被淘汰,这里仅做兜底处理
|
||||
@@ -1395,7 +1395,7 @@ class VideoDetailController extends GetxController
|
||||
);
|
||||
setVideoHeight();
|
||||
|
||||
videoUrl = VideoUtils.getCdnUrl(firstVideo);
|
||||
videoUrl = VideoUtils.getCdnUrl(firstVideo.playUrls);
|
||||
|
||||
/// 优先顺序 设置中指定质量 -> 当前可选的最高质量
|
||||
AudioItem? firstAudio;
|
||||
@@ -1414,7 +1414,7 @@ class VideoDetailController extends GetxController
|
||||
(e) => e.id == closestNumber,
|
||||
orElse: () => audioList.first,
|
||||
);
|
||||
audioUrl = VideoUtils.getCdnUrl(firstAudio);
|
||||
audioUrl = VideoUtils.getCdnUrl(firstAudio.playUrls, isAudio: true);
|
||||
if (firstAudio.id case final int id?) {
|
||||
currentAudioQa = AudioQuality.fromCode(id);
|
||||
}
|
||||
@@ -2001,13 +2001,14 @@ class VideoDetailController extends GetxController
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (res.isSuccess) {
|
||||
final PlayUrlModel data = res.data;
|
||||
final data = res.data;
|
||||
final first = data.durl?.firstOrNull;
|
||||
final url = first?.backupUrl?.lastOrNull ?? first?.url;
|
||||
if (url == null || url.isEmpty) {
|
||||
if (first == null || first.playUrls.isEmpty) {
|
||||
SmartDialog.showToast('不支持投屏');
|
||||
return;
|
||||
}
|
||||
final url = VideoUtils.getCdnUrl(first.playUrls);
|
||||
|
||||
String? title;
|
||||
try {
|
||||
if (isUgc) {
|
||||
|
||||
@@ -427,25 +427,23 @@ class HeaderControlState extends State<HeaderControl> {
|
||||
title: const Text('CDN 设置', style: titleStyle),
|
||||
leading: const Icon(MdiIcons.cloudPlusOutline, size: 20),
|
||||
subtitle: Text(
|
||||
'当前:${CDNService.fromCode(VideoUtils.cdnService).desc},无法播放请切换',
|
||||
'当前:${VideoUtils.cdnService.desc},无法播放请切换',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
onTap: () async {
|
||||
Get.back();
|
||||
String? result = await showDialog(
|
||||
CDNService? result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return CdnSelectDialog(
|
||||
sample: videoInfo.dash?.video?.first,
|
||||
sample: videoInfo.dash?.video?.firstOrNull,
|
||||
);
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
VideoUtils.cdnService = result;
|
||||
setting.put(SettingBoxKey.CDNService, result);
|
||||
SmartDialog.showToast(
|
||||
'已设置为 ${CDNService.fromCode(result).desc},正在重载视频',
|
||||
);
|
||||
setting.put(SettingBoxKey.CDNService, result.name);
|
||||
SmartDialog.showToast('已设置为 ${result.desc},正在重载视频');
|
||||
videoDetailCtr.queryVideoUrl(
|
||||
defaultST: videoDetailCtr.playedTime,
|
||||
fromReset: true,
|
||||
|
||||
Reference in New Issue
Block a user