owe
This commit is contained in:
1 parent
9b9f07dea5
commit
2e1974c35d
15 files changed
+406
-169
No files matched your search
@@ -36,6 +36,21 @@ onMounted(async () => {
|
||||
await loadVideos();
|
||||
});
|
||||
|
||||
/**
|
||||
* 发布专辑详情(FindPublishVideoDefault / FindByKey)里,Url 存的是
|
||||
* OrderKey(形如 xxxx-3-3.mp4 的文件名),不是可播放地址;
|
||||
* 真正的原码地址在 FormattedUrl 上(后端 3 参 PackUrl 现在固定返回原码)。
|
||||
* 这里把 Url 补成地址,否则播放器切「原码」时会拿文件名当地址请求、直接 404。
|
||||
* 网盘列表模式(mode=list)的 Url 本身就是完整地址,不受影响。
|
||||
*/
|
||||
const normalizeDetails = (details: PublishVideoDetailDisplayData[]) =>
|
||||
(details ?? []).map((d) => {
|
||||
if (d.Url && !/^(https?:)?\/\//i.test(d.Url)) {
|
||||
d.Url = d.FormattedUrl || "";
|
||||
}
|
||||
return d;
|
||||
});
|
||||
|
||||
const loadVideos = async () => {
|
||||
try {
|
||||
// 模式一:从网盘中心加载某个路径下的所有视频
|
||||
@@ -65,7 +80,9 @@ const loadVideos = async () => {
|
||||
for (const item of dr.Datas) {
|
||||
const detail = new PublishVideoDetailDisplayData();
|
||||
detail.Title = item.OrgFileName;
|
||||
detail.FormattedUrl = item.Url;
|
||||
detail.Url = item.Url; // 原码
|
||||
detail.FormattedM3u8 = item.FormattedM3u8; // 转码(10秒)
|
||||
detail.FormattedUrl = item.FormattedM3u8 || item.Url;
|
||||
// m3u8 通常配套同名 jpg/png 封面,这里把后缀替换成 .png 兜底
|
||||
detail.FormattedPic = (item.FormattedPic || "").replace(/\.m3u8$/, ".png");
|
||||
videos.value.push(detail);
|
||||
@@ -75,12 +92,12 @@ const loadVideos = async () => {
|
||||
// 默认发布视频
|
||||
else if (!publishName.value || publishName.value.length === 0) {
|
||||
const data: PublishVideoData = await publishVideoService.FindPublishVideoDefault();
|
||||
videos.value = data?.Details ?? [];
|
||||
videos.value = normalizeDetails(data?.Details ?? []);
|
||||
}
|
||||
// 按 key 加载
|
||||
else {
|
||||
const data: PublishVideoData = await publishVideoService.FindByKey(publishName.value);
|
||||
videos.value = data?.Details ?? [];
|
||||
videos.value = normalizeDetails(data?.Details ?? []);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
Reference in new issue
Block a user