/** * Day 19 Step 7 — a curated 2-4 minute confirmation sample: opening, a * concept explanation beat, a copy-this notebook card, a formula reveal, a * worked-example reveal, a common-mistakes card, a Q/A exam-answer reveal, * and a practice-sample reveal. Rendered from real scenes in the current * full-chapter plan (not a synthetic timeline), so this is exactly what a * viewer would see in the corresponding part of the full render. * * This must be reviewed and approved before ever rendering the full ~41 * minute chapter — per the Day 19 constraint, no full MP4 render happens in * this phase regardless of how clean the stills/checker look. * * Usage: * npm run video:day19-sample */ import { mkdirSync, writeFileSync } from "node:fs"; import { buildFullChapterTeachingPlan } from "../../src/video/tuition/fullChapterPlan"; import { buildTimeline, type TimelineScene, type TuitionVideoTimeline } from "../../src/video/tuition/renderLessonVideoPlan"; const OUT_DIR = "outputs/video/tuition/sound-waves/scene-review/sample"; // Scene ids picked from the current scene-index.json — one representative // scene per teaching pattern the Day 19 spec asked to confirm. const SAMPLE_SCENE_IDS = [ "opening-4", // opening hook, not an objective dump "opening-10", // today's goals (split, not a 9-line dump) "concept-34", // a concept explanation beat with category label "concept-48", // "copy this" notebook card "formula-238", // formula reveal "worked_example-328", // worked-example reveal "common_mistakes-612", // common-mistakes card "board_answer-650", // Q/A exam-answer reveal (question -> board-style answer) "practice_sample-709", // sample-practice reveal ("Your turn") ]; // `buildFullChapterTeachingPlan` assigns scene ids from a shared // module-level counter, so calling it more than once per process produces a // second plan whose ids don't match the first — build it exactly once and // reuse it for both the full timeline lookup and the `plan` prop below. function buildSampleTimeline(full: TuitionVideoTimeline): TuitionVideoTimeline { const byId = new Map(full.scenes.map((s) => [s.scene.id, s])); let frameCursor = 0; let secondsCursor = 0; const scenes: TimelineScene[] = []; for (const id of SAMPLE_SCENE_IDS) { const chosen = byId.get(id); if (!chosen) { throw new Error(`Day19 sample: scene id "${id}" not found in the current plan's timeline`); } scenes.push({ ...chosen, fromFrame: frameCursor, fromSeconds: secondsCursor, }); frameCursor += chosen.durationInFrames; secondsCursor += chosen.durationSeconds; } return { fps: full.fps, totalFrames: frameCursor, totalSeconds: secondsCursor, scenes }; } function main() { mkdirSync(OUT_DIR, { recursive: true }); const plan = buildFullChapterTeachingPlan({ classLevel: "Class 10", board: "Kerala SSLC", subject: "Physics", chapter: "Sound Waves", }); const full = buildTimeline(plan); const explicitTimeline = buildSampleTimeline(full); writeFileSync(`${OUT_DIR}/render-props.json`, JSON.stringify({ plan, explicitTimeline }, null, 2), "utf-8"); console.log("Day19 Sample Render Props"); console.log("==========================="); console.log(`Scenes: ${explicitTimeline.scenes.length}`); console.log(`Total duration: ${(explicitTimeline.totalSeconds / 60).toFixed(2)} min`); console.log(`Written to ${OUT_DIR}/render-props.json`); } main();