File size: 4,639 Bytes
65d68f5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /**
* DocDoe Cinematic Video Engine β Strict Type System
*
* These types form the contract between the AI script generator and the
* Remotion-based visual renderer. Keep them narrow and explicit β avoid `string`
* wherever a union works.
*
* NO framer-motion in any component that imports from this file.
* All animation must use Remotion's interpolate() / spring() / useCurrentFrame().
*/
// ---------------------------------------------------------------------------
// Scene type union β maps every AI-generated scene to a visual template
// ---------------------------------------------------------------------------
export type SceneType =
| "hook" // Opening attention grab β large, bold, dramatic
| "explain" // Core teaching content β hologram board, keywords, body text
| "keyword" // Vocabulary/definition spotlight β big term + meaning chips
| "pyq" // Past year question β exam paper style, marks badge, answer reveal
| "quiz" // Interactive check β question + choices or blank fill
| "recap" // Summary cards β numbered key points
| "mentor"; // Direct-to-camera personal coaching tone β warm, close framing
// ---------------------------------------------------------------------------
// Supporting value types
// ---------------------------------------------------------------------------
export type MentorEmotion =
| "explaining"
| "excited"
| "thinking"
| "serious"
| "recap"
| "doubt"
| "study";
export type CameraMotion = "dolly_in" | "dolly_out" | "pan_left" | "pan_right" | "static";
export type VisualHintType = "diagram" | "equation" | "list" | "comparison" | "none";
export type VisualHint = {
type: VisualHintType;
label?: string;
items?: string[];
};
export type SubtitleSegment = {
/** Seconds from scene start */
start: number;
end: number;
text: string;
};
export type ExamFocusData = {
question: string;
answer: string;
marks: number;
exam_year?: number;
/** How many times asked in past papers */
frequency?: number;
};
// ---------------------------------------------------------------------------
// Core scene and plan types
// ---------------------------------------------------------------------------
export type VideoScene = {
scene_id: number;
type: SceneType;
duration_seconds: number;
/** Headline text β short, displayed large at top of board */
title: string;
/** Body explanation text β 1-3 sentences */
body: string;
/** TTS narration text β may differ from body */
voice_text: string;
/** Max 6 keyword chips shown as staggered tags */
keywords: string[];
visual_hint: VisualHint;
subtitle_segments?: SubtitleSegment[];
mentor_emotion?: MentorEmotion;
camera_motion?: CameraMotion;
/** PYQ scene data β used when type === "pyq" */
exam_focus?: ExamFocusData;
audio_src?: string;
is_mock_audio?: boolean;
};
export type VideoPlan = {
/** Stable plan identifier (used as Remotion composition key) */
id: string;
title: string;
subject: string;
chapter?: string;
language: string;
duration_minutes: number;
/** Override computed total when provided by backend */
total_duration_seconds?: number;
scenes: VideoScene[];
/** Whether the Nila teacher character is shown */
show_mentor: boolean;
/** Shows "Preview" watermark in top-right corner */
show_preview_watermark?: boolean;
};
// ---------------------------------------------------------------------------
// Engine configuration
// ---------------------------------------------------------------------------
export type VideoEngineConfig = {
fps: number;
width: number;
height: number;
format: "16:9" | "9:16";
};
export const VIDEO_ENGINE_FPS = 30 as const;
export const DEFAULT_CONFIG: VideoEngineConfig = {
fps: VIDEO_ENGINE_FPS,
width: 1920,
height: 1080,
format: "16:9",
} as const;
export const VERTICAL_CONFIG: VideoEngineConfig = {
fps: VIDEO_ENGINE_FPS,
width: 1080,
height: 1920,
format: "9:16",
} as const;
// ---------------------------------------------------------------------------
// Interop helpers β adapt existing ExplainerScene β VideoScene
// ---------------------------------------------------------------------------
/** Minimal ExplainerScene fields needed by the interop adapter */
export type LegacySceneInput = {
scene_id: number;
type: string;
duration_seconds: number;
screen_text: string;
voice_text: string;
keywords: string[];
visual_hint: string;
subtitle_segments?: Array<{ start: number; end: number; text: string }>;
mascot_expression?: string | null;
};
|