@slidevideo/cli 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -2
  3. package/addons/slidevideo/geometry.ts +334 -1
  4. package/addons/slidevideo/global-top.vue +311 -24
  5. package/addons/slidevideo/preview.ts +242 -25
  6. package/assets/fonts/OFL-LICENSES.txt +95 -0
  7. package/assets/fonts/instrument-serif-latin-2.woff2 +0 -0
  8. package/assets/fonts/instrument-serif-latin-ext-1.woff2 +0 -0
  9. package/assets/fonts/jetbrains-mono-latin-4.woff2 +0 -0
  10. package/assets/fonts/jetbrains-mono-latin-ext-3.woff2 +0 -0
  11. package/assets/fonts/plus-jakarta-sans-latin-6.woff2 +0 -0
  12. package/assets/fonts/plus-jakarta-sans-latin-ext-5.woff2 +0 -0
  13. package/dist/adapters/browser-runtime.d.ts +13 -1
  14. package/dist/adapters/capture-compression.d.ts +15 -0
  15. package/dist/adapters/capture-compression.js +69 -0
  16. package/dist/adapters/powerpoint-preview.d.ts +1 -1
  17. package/dist/adapters/powerpoint-preview.js +13 -2
  18. package/dist/adapters/powerpoint.js +108 -16
  19. package/dist/adapters/slidev-inspection.js +7 -2
  20. package/dist/adapters/slidev.js +362 -3
  21. package/dist/annotation-paint.d.ts +195 -5
  22. package/dist/annotation-paint.js +1188 -2
  23. package/dist/annotations.d.ts +26 -2
  24. package/dist/annotations.js +1117 -29
  25. package/dist/captions.d.ts +6 -0
  26. package/dist/captions.js +320 -0
  27. package/dist/cli.js +40 -17
  28. package/dist/compositor.js +51 -3
  29. package/dist/contracts.d.ts +253 -14
  30. package/dist/pipeline.d.ts +6 -1
  31. package/dist/pipeline.js +66 -19
  32. package/dist/preview/contracts.d.ts +14 -0
  33. package/dist/preview/player.js +523 -33
  34. package/dist/preview/server.d.ts +1 -1
  35. package/dist/preview/server.js +124 -3
  36. package/dist/preview/view.d.ts +1 -1
  37. package/dist/preview/view.js +26 -7
  38. package/dist/run.d.ts +1 -0
  39. package/dist/run.js +20 -0
  40. package/dist/speech.d.ts +10 -1
  41. package/dist/speech.js +18 -2
  42. package/dist/stamp-fonts.d.ts +17 -0
  43. package/dist/stamp-fonts.js +202 -0
  44. package/dist/storyboard.js +60 -3
  45. package/dist/timing.d.ts +2 -0
  46. package/dist/timing.js +277 -11
  47. package/package.json +14 -1
  48. package/schemas/annotation-geometry.v1.json +111 -0
  49. package/schemas/schedule.v1.json +1672 -84
  50. package/schemas/storyboard.v1.json +3725 -85
  51. package/skills/slidevideo/SKILL.md +5 -5
  52. package/skills/slidevideo/references/decks.md +6 -4
  53. package/skills/slidevideo/references/production.md +12 -11
  54. package/skills/slidevideo/references/storyboard.md +268 -5
  55. package/tools/powerpoint/powerpoint.ps1 +278 -40
  56. package/tools/powerpoint/preview.ps1 +69 -1
@@ -53,6 +53,25 @@ export type Rectangle = {
53
53
  width: number;
54
54
  height: number;
55
55
  };
56
+ export type TextContainerTarget = {
57
+ type: 'element';
58
+ selector: string;
59
+ } | {
60
+ type: 'shape';
61
+ id: number;
62
+ };
63
+ export type TextTarget = {
64
+ type: 'text';
65
+ container?: TextContainerTarget;
66
+ text: string;
67
+ occurrence?: number;
68
+ };
69
+ export type ResolvedTextTarget = TextTarget & {
70
+ slice?: {
71
+ start: number;
72
+ end: number;
73
+ };
74
+ };
56
75
  export type AnnotationTarget = ({
57
76
  type: 'region';
58
77
  units: 'normalized';
@@ -62,10 +81,35 @@ export type AnnotationTarget = ({
62
81
  } | {
63
82
  type: 'shape';
64
83
  id: number;
65
- };
66
- export type GeometryTarget = AnnotationTarget | {
84
+ } | TextTarget;
85
+ export type ResolvedAnnotationTarget = Exclude<AnnotationTarget, TextTarget> | ResolvedTextTarget;
86
+ export type GeometryTarget = ResolvedAnnotationTarget | {
67
87
  type: 'slide';
68
88
  };
89
+ export type WordFollowTokenMap = {
90
+ text: string;
91
+ occurrence?: number;
92
+ phrase: string;
93
+ phrase_occurrence?: number;
94
+ };
95
+ export type WordFollowTiming = {
96
+ segment: string;
97
+ phrase?: string;
98
+ occurrence?: number;
99
+ mode?: 'words' | 'phrase';
100
+ offset_ms?: number;
101
+ linger_ms?: number;
102
+ tokens?: WordFollowTokenMap[];
103
+ };
104
+ export type AnnotationTiming = {
105
+ at: number | PhraseCue;
106
+ duration_ms: number;
107
+ follow?: never;
108
+ } | {
109
+ follow: WordFollowTiming;
110
+ at?: never;
111
+ duration_ms?: never;
112
+ };
69
113
  export type HighlightAppearance = {
70
114
  color: string;
71
115
  opacity: number;
@@ -82,15 +126,14 @@ export type HighlightAppearance = {
82
126
  height: number;
83
127
  };
84
128
  };
85
- export type HighlightAnnotation = {
129
+ export type HighlightAnnotationBase = {
86
130
  id: string;
87
131
  scene: string;
88
132
  effect: 'highlight';
89
133
  target: AnnotationTarget;
90
134
  appearance: HighlightAppearance;
91
- at: PhraseCue;
92
- duration_ms: number;
93
135
  };
136
+ export type HighlightAnnotation = HighlightAnnotationBase & AnnotationTiming;
94
137
  export type UnderlineAppearance = {
95
138
  color: string;
96
139
  opacity: number;
@@ -106,33 +149,229 @@ export type UnderlineMotion = {
106
149
  in_ms?: number;
107
150
  out_ms?: number;
108
151
  };
109
- export type UnderlineAnnotation = {
152
+ export type UnderlineAnnotationBase = {
110
153
  id: string;
111
154
  scene: string;
112
155
  effect: 'underline';
113
156
  target: AnnotationTarget;
114
157
  appearance: UnderlineAppearance;
115
158
  motion?: UnderlineMotion;
116
- at: PhraseCue;
117
- duration_ms: number;
118
159
  };
119
- export type Annotation = HighlightAnnotation | UnderlineAnnotation;
160
+ export type UnderlineAnnotation = UnderlineAnnotationBase & AnnotationTiming;
161
+ export type SpotlightPadding = {
162
+ units: 'normalized';
163
+ x: number;
164
+ y: number;
165
+ };
166
+ export type SpotlightAppearance = {
167
+ color?: string;
168
+ opacity: number;
169
+ shape?: 'rounded-rect';
170
+ radius?: number;
171
+ softness?: number;
172
+ padding?: SpotlightPadding;
173
+ } | {
174
+ color?: string;
175
+ opacity: number;
176
+ shape: 'ellipse';
177
+ softness?: number;
178
+ padding?: SpotlightPadding;
179
+ };
180
+ export type SpotlightMotion = {
181
+ type: 'fade';
182
+ in_ms?: number;
183
+ out_ms?: number;
184
+ };
185
+ export type SpotlightAnnotationBase = {
186
+ id: string;
187
+ scene: string;
188
+ effect: 'spotlight';
189
+ target: AnnotationTarget;
190
+ appearance: SpotlightAppearance;
191
+ motion?: SpotlightMotion;
192
+ };
193
+ export type SpotlightAnnotation = SpotlightAnnotationBase & AnnotationTiming;
194
+ export type ZoomPadding = {
195
+ units: 'normalized';
196
+ x: number;
197
+ y: number;
198
+ };
199
+ export type ZoomEasing = 'ease-in-out' | 'linear';
200
+ export type ZoomAppearance = {
201
+ fit?: 'contain' | 'cover';
202
+ scale?: number;
203
+ max_scale?: number;
204
+ padding?: ZoomPadding;
205
+ };
206
+ export type ZoomMotion = {
207
+ type: 'ease';
208
+ in_ms?: number;
209
+ out_ms?: number;
210
+ easing?: ZoomEasing;
211
+ };
212
+ export type ZoomAnnotationBase = {
213
+ id: string;
214
+ scene: string;
215
+ effect: 'zoom';
216
+ target: AnnotationTarget;
217
+ appearance?: ZoomAppearance;
218
+ motion?: ZoomMotion;
219
+ };
220
+ export type ZoomAnnotation = ZoomAnnotationBase & AnnotationTiming;
221
+ export type LaserAnchor = 'center' | 'top-left' | 'top' | 'top-right' | 'left' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
222
+ export type LaserWaypoint = {
223
+ x: number;
224
+ y: number;
225
+ dwell_ms?: number;
226
+ } | {
227
+ target: AnnotationTarget;
228
+ anchor?: LaserAnchor;
229
+ dwell_ms?: number;
230
+ };
231
+ export type ResolvedLaserWaypoint = {
232
+ x: number;
233
+ y: number;
234
+ dwell_ms?: number;
235
+ } | {
236
+ target: ResolvedAnnotationTarget;
237
+ anchor?: LaserAnchor;
238
+ dwell_ms?: number;
239
+ };
240
+ export type LaserPathTarget = {
241
+ type: 'path';
242
+ units: 'normalized';
243
+ points: LaserWaypoint[];
244
+ };
245
+ export type ResolvedLaserPathTarget = {
246
+ type: 'path';
247
+ units: 'normalized';
248
+ points: ResolvedLaserWaypoint[];
249
+ };
250
+ export type LaserInterpolation = 'linear' | 'smooth';
251
+ export type LaserAppearance = {
252
+ color?: string;
253
+ opacity?: number;
254
+ radius?: number;
255
+ glow?: number;
256
+ trail_ms?: number;
257
+ interpolation?: LaserInterpolation;
258
+ };
259
+ export type LaserMotion = {
260
+ type: 'fade';
261
+ in_ms?: number;
262
+ out_ms?: number;
263
+ };
264
+ export type LaserAnnotationBase = {
265
+ id: string;
266
+ scene: string;
267
+ effect: 'laser';
268
+ target: LaserPathTarget;
269
+ appearance?: LaserAppearance;
270
+ motion?: LaserMotion;
271
+ };
272
+ export type LaserAnnotation = LaserAnnotationBase & AnnotationTiming;
273
+ export type TargetAnchor = LaserAnchor;
274
+ export type StampTarget = AnnotationTarget | {
275
+ type: 'point';
276
+ units: 'normalized';
277
+ x: number;
278
+ y: number;
279
+ };
280
+ export type ResolvedStampTarget = ResolvedAnnotationTarget | {
281
+ type: 'point';
282
+ units: 'normalized';
283
+ x: number;
284
+ y: number;
285
+ };
286
+ export type StampSymbol = 'check' | 'cross' | 'warning' | 'star' | 'info' | 'arrow-right';
287
+ export type StampFont = 'sans' | 'mono' | 'serif';
288
+ export type StampPadding = {
289
+ units: 'normalized';
290
+ x: number;
291
+ y: number;
292
+ };
293
+ export type StampOffset = {
294
+ units: 'normalized';
295
+ x: number;
296
+ y: number;
297
+ };
298
+ export type StampBorder = {
299
+ color: string;
300
+ opacity?: number;
301
+ width?: number;
302
+ };
303
+ export type StampAppearance = {
304
+ text?: string;
305
+ symbol?: StampSymbol;
306
+ font?: StampFont;
307
+ size?: number;
308
+ color?: string;
309
+ opacity?: number;
310
+ background?: string;
311
+ background_opacity?: number;
312
+ border?: StampBorder;
313
+ radius?: number;
314
+ padding?: StampPadding;
315
+ anchor?: TargetAnchor;
316
+ offset?: StampOffset;
317
+ rotation_deg?: number;
318
+ max_width?: number;
319
+ align?: 'left' | 'center' | 'right';
320
+ overflow?: 'error' | 'clip';
321
+ };
322
+ export type StampMotion = {
323
+ type: 'fade';
324
+ in_ms?: number;
325
+ out_ms?: number;
326
+ } | {
327
+ type: 'pop';
328
+ in_ms?: number;
329
+ out_ms?: number;
330
+ start_scale?: number;
331
+ };
332
+ export type StampAnnotationBase = {
333
+ id: string;
334
+ scene: string;
335
+ effect: 'stamp';
336
+ target: StampTarget;
337
+ appearance: StampAppearance;
338
+ motion?: StampMotion;
339
+ };
340
+ export type StampAnnotation = StampAnnotationBase & AnnotationTiming;
341
+ export type Annotation = HighlightAnnotation | UnderlineAnnotation | SpotlightAnnotation | ZoomAnnotation | LaserAnnotation | StampAnnotation;
120
342
  export type ResolvedAnnotationWindow = {
121
343
  start_ms: number;
122
344
  end_ms: number;
123
345
  slide: string;
124
346
  visit: string;
125
347
  click: number;
126
- cue_span: {
348
+ cue_span?: {
127
349
  segment: string;
128
350
  start: number;
129
351
  end: number;
130
352
  form: string;
131
353
  };
132
- };
133
- export type ResolvedHighlightAnnotation = HighlightAnnotation & ResolvedAnnotationWindow;
134
- export type ResolvedUnderlineAnnotation = UnderlineAnnotation & ResolvedAnnotationWindow;
135
- export type ResolvedAnnotation = ResolvedHighlightAnnotation | ResolvedUnderlineAnnotation;
354
+ source_id?: string;
355
+ };
356
+ export type ResolvedHighlightAnnotation = Omit<HighlightAnnotationBase, 'target'> & {
357
+ target: ResolvedAnnotationTarget;
358
+ } & ResolvedAnnotationWindow;
359
+ export type ResolvedUnderlineAnnotation = Omit<UnderlineAnnotationBase, 'target'> & {
360
+ target: ResolvedAnnotationTarget;
361
+ } & ResolvedAnnotationWindow;
362
+ export type ResolvedSpotlightAnnotation = Omit<SpotlightAnnotationBase, 'target'> & {
363
+ target: ResolvedAnnotationTarget;
364
+ } & ResolvedAnnotationWindow;
365
+ export type ResolvedZoomAnnotation = Omit<ZoomAnnotationBase, 'target'> & {
366
+ target: ResolvedAnnotationTarget;
367
+ } & ResolvedAnnotationWindow;
368
+ export type ResolvedLaserAnnotation = Omit<LaserAnnotationBase, 'target'> & {
369
+ target: ResolvedLaserPathTarget;
370
+ } & ResolvedAnnotationWindow;
371
+ export type ResolvedStampAnnotation = Omit<StampAnnotationBase, 'target'> & {
372
+ target: ResolvedStampTarget;
373
+ } & ResolvedAnnotationWindow;
374
+ export type ResolvedAnnotation = ResolvedHighlightAnnotation | ResolvedUnderlineAnnotation | ResolvedSpotlightAnnotation | ResolvedZoomAnnotation | ResolvedLaserAnnotation | ResolvedStampAnnotation;
136
375
  export type GeometryRequest = {
137
376
  key: string;
138
377
  target: GeometryTarget;
@@ -1,4 +1,5 @@
1
1
  import { type FrameRate, type Viewport, type ProgressReporter } from './contracts.js';
2
+ import { type CaptionSelection } from './captions.js';
2
3
  export type InspectInput = {
3
4
  kind: 'storyboard';
4
5
  storyboard: string;
@@ -15,13 +16,15 @@ export type Options = {
15
16
  viewport?: Viewport;
16
17
  fps?: FrameRate;
17
18
  run?: string;
18
- cache?: string;
19
+ cache?: string | false;
19
20
  output?: string;
21
+ captions?: CaptionSelection;
20
22
  resume?: boolean;
21
23
  export?: string;
22
24
  verify_timing?: boolean;
23
25
  timeout_ms?: number;
24
26
  progress?: ProgressReporter;
27
+ onRunResolved?: (directory: string) => void;
25
28
  };
26
29
  export declare function produce(options: Options): Promise<{
27
30
  version: number;
@@ -31,6 +34,7 @@ export declare function produce(options: Options): Promise<{
31
34
  warnings: string[];
32
35
  completed_stages: string[];
33
36
  run_id: string | undefined;
37
+ run_dir: string | undefined;
34
38
  timing_status: string;
35
39
  } | {
36
40
  version: number;
@@ -40,6 +44,7 @@ export declare function produce(options: Options): Promise<{
40
44
  warnings: string[];
41
45
  completed_stages: string[];
42
46
  run_id: string | undefined;
47
+ run_dir: string | undefined;
43
48
  timing_status: string;
44
49
  inspection: {
45
50
  annotation_targets: {
package/dist/pipeline.js CHANGED
@@ -1,14 +1,16 @@
1
1
  import { mkdir, readdir, rm } from 'node:fs/promises';
2
- import { join, resolve } from 'node:path';
2
+ import { dirname, join, resolve } from 'node:path';
3
3
  import { defaultVideoOutput, defaultViewport } from './contracts.js';
4
4
  import { loadStoryboard, fingerprint } from './storyboard.js';
5
5
  import { presentationAdapter, ttsAdapters } from './adapters/registry.js';
6
- import { generateSpeech } from './speech.js';
6
+ import { generateSpeech, resolveSpeechCache } from './speech.js';
7
7
  import { resolveTiming } from './timing.js';
8
- import { Run, filesIn } from './run.js';
8
+ import { Run, createDefaultRunDirectory, filesIn } from './run.js';
9
9
  import { json, saveJson, execute, executionScope } from './media.js';
10
10
  import { assemble } from './assembly.js';
11
+ import { writeCaptions } from './captions.js';
11
12
  import { configuredLicense } from './executables.js';
13
+ import { stampFontInputFiles } from './stamp-fonts.js';
12
14
  import { requireCondition, ProductionError } from './errors.js';
13
15
  const baseStageTimeoutMs = 180_000;
14
16
  function defaultStageTimeoutMs(stage, story, options) {
@@ -71,7 +73,7 @@ export async function produce(options) {
71
73
  warnings.push('Slides without explicit click bounds require runtime reveal checks before recording.');
72
74
  if ((inspection.unsupported?.length ?? 0) > 0)
73
75
  warnings.push('Deck contains unsupported native features. Adjust the deck before production.');
74
- return { version: 1, command: options.command, status: 'completed', artifacts: {}, warnings, completed_stages: [], run_id: undefined, timing_status: 'not_evaluated', inspection: { ...inspection, annotation_targets } };
76
+ return { version: 1, command: options.command, status: 'completed', artifacts: {}, warnings, completed_stages: [], run_id: undefined, run_dir: undefined, timing_status: 'not_evaluated', inspection: { ...inspection, annotation_targets } };
75
77
  }
76
78
  finally {
77
79
  await adapter.cleanup();
@@ -107,7 +109,7 @@ export async function produce(options) {
107
109
  tts.validate(voice);
108
110
  }
109
111
  const result = { version: 1, command: options.command, status: 'completed', artifacts: {}, warnings: story.cues.length || story.annotations.length ||
110
- overlays.some(overlay => overlay.visible?.some(interval => typeof interval.start !== 'number' || typeof interval.end !== 'number')) ? ['Phrase cues require paired speech alignment at resolution.'] : [], completed_stages: [], run_id: undefined, timing_status: 'not_evaluated' };
112
+ overlays.some(overlay => overlay.visible?.some(interval => typeof interval.start !== 'number' || typeof interval.end !== 'number')) ? ['Phrase cues require paired speech alignment at resolution.'] : [], completed_stages: [], run_id: undefined, run_dir: undefined, timing_status: 'not_evaluated' };
111
113
  if (story.cues.some(cue => cue.action.type === 'slide'))
112
114
  result.warnings.push('Phrase-driven navigation requires reveal target checks after resolution.');
113
115
  if (inspection.slides.some(slide => slide.clicks_known === false))
@@ -125,7 +127,7 @@ export async function produce(options) {
125
127
  activeAdapter = undefined;
126
128
  }
127
129
  }
128
- const inputs = [...inspection.files, ...story.media.map(media => media.src), ...overlays.map(overlay => overlay.src)];
130
+ const inputs = [...inspection.files, ...story.media.map(media => media.src), ...overlays.map(overlay => overlay.src), ...stampFontInputFiles(story.annotations)];
129
131
  if (options.command === 'validate') {
130
132
  const fingerprints = await fingerprint(source, inputs);
131
133
  await validateOverlayAssets(fingerprints.inputs);
@@ -140,21 +142,33 @@ export async function produce(options) {
140
142
  for (const overlay of assets.values())
141
143
  await loadOverlayImage(overlay, hashes[overlay.src]);
142
144
  }
143
- requireCondition(options.run, 'RUN_REQUIRED', `${options.command} requires --run`);
144
- const directory = resolve(options.run);
145
- if (options.command === 'build' && !options.resume) {
146
- let entries = [];
147
- try {
148
- entries = await readdir(directory);
145
+ const allowDefaultRun = (options.command === 'build' && !options.resume) || options.command === 'tts';
146
+ requireCondition(options.run || allowDefaultRun, 'RUN_REQUIRED', options.command === 'build' && options.resume ? 'build --resume requires --run' : `${options.command} requires --run`);
147
+ let directory;
148
+ if (options.run) {
149
+ directory = resolve(options.run);
150
+ if (options.command === 'build' && !options.resume) {
151
+ let entries = [];
152
+ try {
153
+ entries = await readdir(directory);
154
+ }
155
+ catch (error) {
156
+ if (error.code !== 'ENOENT')
157
+ throw error;
158
+ }
159
+ requireCondition(entries.length === 0, 'NEW_RUN_REQUIRED', 'build requires a new or empty directory. Use --resume for unchanged inputs.');
160
+ await adapter.validate(story, inspection, { viewport: options.viewport ?? defaultViewport });
149
161
  }
150
- catch (error) {
151
- if (error.code !== 'ENOENT')
152
- throw error;
162
+ await mkdir(directory, { recursive: true });
163
+ }
164
+ else {
165
+ if (options.command === 'build') {
166
+ await adapter.validate(story, inspection, { viewport: options.viewport ?? defaultViewport });
153
167
  }
154
- requireCondition(entries.length === 0, 'NEW_RUN_REQUIRED', 'build requires a new or empty directory. Use --resume for unchanged inputs.');
155
- await adapter.validate(story, inspection, { viewport: options.viewport ?? defaultViewport });
168
+ directory = await createDefaultRunDirectory();
156
169
  }
157
- await mkdir(directory, { recursive: true });
170
+ result.run_dir = directory;
171
+ options.onRunResolved?.(directory);
158
172
  lock = join(directory, '.lock');
159
173
  try {
160
174
  await mkdir(lock);
@@ -276,7 +290,7 @@ export async function produce(options) {
276
290
  const prehashed = {};
277
291
  const operation = async () => {
278
292
  if (stage === 'tts') {
279
- const speech = await generateSpeech(story, join(directory, 'speech'), ttsAdapters, options.cache, options.progress);
293
+ const speech = await generateSpeech(story, join(directory, 'speech'), ttsAdapters, resolveSpeechCache(source, options.cache), options.progress);
280
294
  artifacts.push(speechPath, ...speech.assets.map(asset => asset.audio));
281
295
  }
282
296
  if (stage === 'resolve') {
@@ -356,6 +370,39 @@ export async function produce(options) {
356
370
  }
357
371
  if (result.completed_stages.includes('assemble'))
358
372
  result.artifacts.video = run.manifest.output;
373
+ const captionSelection = options.captions
374
+ ?? (result.completed_stages.includes('assemble') && story.narration.length > 0 ? 'both' : 'none');
375
+ if (captionSelection !== 'none') {
376
+ await run.verify('tts');
377
+ await run.verify('resolve');
378
+ const schedule = await json(schedulePath);
379
+ const speech = await json(speechPath);
380
+ if (result.completed_stages.includes('assemble') && run.manifest.output) {
381
+ let audioOriginMs = 0;
382
+ try {
383
+ const report = await json(reportPath);
384
+ if (typeof report.audio_origin_ms === 'number' && Number.isFinite(report.audio_origin_ms))
385
+ audioOriginMs = report.audio_origin_ms;
386
+ }
387
+ catch { }
388
+ const externalOutput = dirname(run.manifest.output) !== directory;
389
+ const writeBesideOutput = !externalOutput || options.captions !== undefined;
390
+ const basePath = writeBesideOutput ? run.manifest.output.replace(/\.mp4$/i, '') : join(directory, 'final');
391
+ const written = await writeCaptions(schedule, speech, captionSelection, basePath, audioOriginMs, { protectExisting: externalOutput && writeBesideOutput });
392
+ if (written.vtt)
393
+ result.artifacts.captions_vtt = written.vtt;
394
+ if (written.srt)
395
+ result.artifacts.captions_srt = written.srt;
396
+ }
397
+ else {
398
+ const basePath = join(directory, 'timing', 'captions');
399
+ const written = await writeCaptions(schedule, speech, captionSelection, basePath, 0);
400
+ if (written.vtt)
401
+ result.artifacts.captions_vtt = written.vtt;
402
+ if (written.srt)
403
+ result.artifacts.captions_srt = written.srt;
404
+ }
405
+ }
359
406
  if (result.completed_stages.includes('record') && result.timing_status === 'not_evaluated')
360
407
  result.warnings.push(result.completed_stages.includes('assemble') ? 'Timing was not verified. The delivered video is ready for user review.' : 'Timing was not verified. Assemble the capture to produce the video.');
361
408
  return result;
@@ -6,12 +6,26 @@ export interface NativePreview {
6
6
  export type PreviewSession = {
7
7
  url: string;
8
8
  } | NativePreview;
9
+ export type PreviewScene = {
10
+ id: string;
11
+ slide: string;
12
+ start_ms: number;
13
+ end_ms: number;
14
+ };
15
+ export type PreviewAudioCue = {
16
+ segment: string;
17
+ start_ms: number;
18
+ end_ms: number;
19
+ url: string;
20
+ };
9
21
  export type PlayerConfig = {
10
22
  deck: string;
11
23
  duration: number;
12
24
  width: number;
13
25
  height: number;
14
26
  approximate: string[];
27
+ scenes: PreviewScene[];
28
+ audio: PreviewAudioCue[];
15
29
  stage: {
16
30
  url: string;
17
31
  } | {