feat(course): add per-module narrated video pipeline
Each course module now carries a video record, the generator embeds a module video block, and the checker requires 15 H.264/AAC 720p videos between 3 and 8 minutes. The recorder prepares module narration, runs the module actions with the lesson overlay, records/mixes the video, and writes per-module reports; it also uses OPFS save/reopen paths. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,20 @@ for (const match of html.matchAll(/<video[^>]+src="([^"]+)"/g)) {
|
||||
if (video.width !== 1280 || video.height !== 720) errors.push(`${match[1]} is not 1280x720`);
|
||||
}
|
||||
|
||||
const result = { schemaVersion: 1, status: errors.length === 0 ? "PASS" : "FAIL", modules, videos: media.length, media, errors };
|
||||
const moduleIds = [...html.matchAll(/data-module-video="([^"]+)"/g)].map((match) => match[1]);
|
||||
if (moduleIds.length !== 15) errors.push(`expected 15 module videos, found ${moduleIds.length}`);
|
||||
if (new Set(moduleIds).size !== moduleIds.length) errors.push("duplicate module video ids");
|
||||
const moduleMedia = media.filter((item) => /(^|\/)video\/M\d+-lesson-/.test(item.src));
|
||||
if (moduleMedia.length !== 15) errors.push(`expected 15 module video files, found ${moduleMedia.length}`);
|
||||
for (const item of moduleMedia) {
|
||||
if (item.duration < 180 || item.duration > 480) errors.push(`${item.src} duration ${item.duration}s outside 180-480s`);
|
||||
}
|
||||
for (const moduleId of moduleIds) {
|
||||
const slugPrefix = `video/${moduleId}-lesson`;
|
||||
if (!html.includes(`src="${slugPrefix}-720p.mp4"`)) errors.push(`${moduleId} video src missing`);
|
||||
if (!html.includes(`${slugPrefix}-poster.jpg`)) errors.push(`${moduleId} poster missing`);
|
||||
if (!html.includes(`${slugPrefix}.zh-Hans.vtt`)) errors.push(`${moduleId} VTT missing`);
|
||||
}
|
||||
const result = { schemaVersion: 1, status: errors.length === 0 ? "PASS" : "FAIL", modules, moduleVideos: moduleIds.length, videos: media.length, totalMediaBytes: media.reduce((total, item) => total + (item.bytes ?? 0), 0), media, errors };
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
if (errors.length > 0) process.exitCode = 1;
|
||||
|
||||
Reference in New Issue
Block a user