feat: 添加创建m3u8文件的函数

新增createM3u8函数用于生成m3u8文件路径,当任务进行中时返回原视频mp4路径
This commit is contained in:
2026-01-09 15:36:23 +08:00
parent a07000ed44
commit 8a639576b6

View File

@@ -114,6 +114,13 @@ function getMimeFromUrl(u) {
return 'image/jpeg';
}
/**
* 创建m3u8文件, 并返回 m3u8 路径, 如任务正在进行中则返回原视频 mp4 路径
*/
async function createM3u8Task(contentPath, apiData) {
}
/**
* 生成缩略图并缓存
* @param {*} reply
@@ -372,8 +379,6 @@ async function downloadAndServe(reply, apiData, contentPath, key) {
});
}
if (task.done && fs.existsSync(contentPath)) {
console.log('Download completed:', key);
if (isValidThumbSpec(apiData.data.thumb)) {
@@ -382,12 +387,10 @@ async function downloadAndServe(reply, apiData, contentPath, key) {
return serveCompletedCache(reply, apiData, contentPath);//reply, apiData, contentPath
}
console.log('Downloading:', key);
if (isValidThumbSpec(apiData.data.thumb)) {
return generateThumbAndCache(reply, apiData, contentPath).catch(() => { });
}
// Serve growing file
return serveGrowingFile(reply, task, apiData);
}