@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.
- package/CHANGELOG.md +18 -0
- package/README.md +2 -2
- package/addons/slidevideo/geometry.ts +334 -1
- package/addons/slidevideo/global-top.vue +311 -24
- package/addons/slidevideo/preview.ts +242 -25
- package/assets/fonts/OFL-LICENSES.txt +95 -0
- package/assets/fonts/instrument-serif-latin-2.woff2 +0 -0
- package/assets/fonts/instrument-serif-latin-ext-1.woff2 +0 -0
- package/assets/fonts/jetbrains-mono-latin-4.woff2 +0 -0
- package/assets/fonts/jetbrains-mono-latin-ext-3.woff2 +0 -0
- package/assets/fonts/plus-jakarta-sans-latin-6.woff2 +0 -0
- package/assets/fonts/plus-jakarta-sans-latin-ext-5.woff2 +0 -0
- package/dist/adapters/browser-runtime.d.ts +13 -1
- package/dist/adapters/capture-compression.d.ts +15 -0
- package/dist/adapters/capture-compression.js +69 -0
- package/dist/adapters/powerpoint-preview.d.ts +1 -1
- package/dist/adapters/powerpoint-preview.js +13 -2
- package/dist/adapters/powerpoint.js +108 -16
- package/dist/adapters/slidev-inspection.js +7 -2
- package/dist/adapters/slidev.js +362 -3
- package/dist/annotation-paint.d.ts +195 -5
- package/dist/annotation-paint.js +1188 -2
- package/dist/annotations.d.ts +26 -2
- package/dist/annotations.js +1117 -29
- package/dist/captions.d.ts +6 -0
- package/dist/captions.js +320 -0
- package/dist/cli.js +40 -17
- package/dist/compositor.js +51 -3
- package/dist/contracts.d.ts +253 -14
- package/dist/pipeline.d.ts +6 -1
- package/dist/pipeline.js +66 -19
- package/dist/preview/contracts.d.ts +14 -0
- package/dist/preview/player.js +523 -33
- package/dist/preview/server.d.ts +1 -1
- package/dist/preview/server.js +124 -3
- package/dist/preview/view.d.ts +1 -1
- package/dist/preview/view.js +26 -7
- package/dist/run.d.ts +1 -0
- package/dist/run.js +20 -0
- package/dist/speech.d.ts +10 -1
- package/dist/speech.js +18 -2
- package/dist/stamp-fonts.d.ts +17 -0
- package/dist/stamp-fonts.js +202 -0
- package/dist/storyboard.js +60 -3
- package/dist/timing.d.ts +2 -0
- package/dist/timing.js +277 -11
- package/package.json +14 -1
- package/schemas/annotation-geometry.v1.json +111 -0
- package/schemas/schedule.v1.json +1672 -84
- package/schemas/storyboard.v1.json +3725 -85
- package/skills/slidevideo/SKILL.md +5 -5
- package/skills/slidevideo/references/decks.md +6 -4
- package/skills/slidevideo/references/production.md +12 -11
- package/skills/slidevideo/references/storyboard.md +268 -5
- package/tools/powerpoint/powerpoint.ps1 +278 -40
- package/tools/powerpoint/preview.ps1 +69 -1
|
@@ -6,6 +6,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
6
6
|
import { nativePreview } from './powerpoint-preview.js';
|
|
7
7
|
import { defaultVideoOutput, defaultViewport } from '../contracts.js';
|
|
8
8
|
import { geometryRequests } from '../annotation-paint.js';
|
|
9
|
+
import { planStaticSkips, remapCaptureTimestamps } from './capture-compression.js';
|
|
9
10
|
import { calibrate, estimateOrigin } from '../calibration.js';
|
|
10
11
|
import { executionSignal, hasStageDeadline, hashFile, json, probe, saveJson, videoFramePeriod } from '../media.js';
|
|
11
12
|
import { ProductionError, requireCondition } from '../errors.js';
|
|
@@ -49,7 +50,15 @@ function parseDeck(value) {
|
|
|
49
50
|
for (const shape of slide.shapes) {
|
|
50
51
|
requireCondition(object(shape), 'POWERPOINT_PROTOCOL', 'Native inspection returned an invalid shape identity', 5);
|
|
51
52
|
const bounds = shape.bounds;
|
|
52
|
-
requireCondition(Number.isInteger(shape.id) &&
|
|
53
|
+
requireCondition(Number.isInteger(shape.id) &&
|
|
54
|
+
typeof shape.name === 'string' &&
|
|
55
|
+
object(bounds) &&
|
|
56
|
+
['x', 'y', 'width', 'height'].every(key => finite(bounds[key])) &&
|
|
57
|
+
finite(shape.visible_from_click) &&
|
|
58
|
+
Array.isArray(shape.unsupported) &&
|
|
59
|
+
shape.unsupported.every(reason => typeof reason === 'string') &&
|
|
60
|
+
(shape.text === undefined || shape.text === null || typeof shape.text === 'string') &&
|
|
61
|
+
(shape.text_unsupported === undefined || (Array.isArray(shape.text_unsupported) && shape.text_unsupported.every(reason => typeof reason === 'string'))), 'POWERPOINT_PROTOCOL', 'Native inspection returned an invalid shape identity', 5);
|
|
53
62
|
}
|
|
54
63
|
for (const effect of slide.effects)
|
|
55
64
|
requireCondition(object(effect) && ['type', 'trigger', 'duration_ms', 'delay_ms', 'repeat_count', 'repeat_duration_ms', 'auto_reverse', 'exit', 'shape', 'paragraph'].every(key => finite(effect[key])), 'POWERPOINT_PROTOCOL', 'Native inspection returned an invalid effect', 5);
|
|
@@ -92,6 +101,16 @@ function validTarget(value, expected) {
|
|
|
92
101
|
case 'region': return value.units === 'normalized' && value.x === expected.x && value.y === expected.y && value.width === expected.width && value.height === expected.height;
|
|
93
102
|
case 'element': return value.selector === expected.selector;
|
|
94
103
|
case 'shape': return value.id === expected.id;
|
|
104
|
+
case 'text': {
|
|
105
|
+
const containerMatches = expected.container === undefined
|
|
106
|
+
? value.container === undefined
|
|
107
|
+
: object(value.container) && value.container.type === expected.container.type &&
|
|
108
|
+
(expected.container.type === 'shape' ? value.container.id === expected.container.id : value.container.selector === expected.container.selector);
|
|
109
|
+
const sliceMatches = expected.slice === undefined
|
|
110
|
+
? value.slice === undefined
|
|
111
|
+
: object(value.slice) && value.slice.start === expected.slice.start && value.slice.end === expected.slice.end;
|
|
112
|
+
return value.text === expected.text && value.occurrence === expected.occurrence && containerMatches && sliceMatches;
|
|
113
|
+
}
|
|
95
114
|
}
|
|
96
115
|
}
|
|
97
116
|
function requestLabel(request) {
|
|
@@ -119,6 +138,12 @@ function parseEvidence(value, directory, verified, requests, output) {
|
|
|
119
138
|
requireCondition(object(marker) && marker.color === colors[index] && finite(marker.observed_ms) && finite(marker.rendered_by_ms) && finite(marker.paint_interval_ms) && marker.rendered_by_ms >= marker.observed_ms && marker.paint_interval_ms >= 0, 'POWERPOINT_PROTOCOL', 'Native marker has no measured paint interval', 6);
|
|
120
139
|
for (const reference of value.references)
|
|
121
140
|
requireCondition(object(reference) && typeof reference.id === 'string' && finite(reference.expected_ms) && typeof reference.before === 'string' && typeof reference.after === 'string' && ['transition', 'sample'].includes(String(reference.mode)) && finite(reference.frame_period_ms), 'POWERPOINT_PROTOCOL', 'Native verification returned an invalid reference', 6);
|
|
141
|
+
if (value.applied_skips !== undefined) {
|
|
142
|
+
requireCondition(Array.isArray(value.applied_skips), 'POWERPOINT_PROTOCOL', 'Native recording returned invalid static skip evidence', 5);
|
|
143
|
+
for (const skip of value.applied_skips) {
|
|
144
|
+
requireCondition(object(skip) && finite(skip.record_at_ms) && Number(skip.record_at_ms) >= 0 && finite(skip.skip_ms) && Number(skip.skip_ms) > 0, 'POWERPOINT_PROTOCOL', 'Native recording returned an invalid static skip entry', 5);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
122
147
|
for (const version of Object.values(value.dependencies))
|
|
123
148
|
requireCondition(typeof version === 'string', 'POWERPOINT_PROTOCOL', 'Native recording returned invalid dependency versions', 5);
|
|
124
149
|
return value;
|
|
@@ -168,7 +193,7 @@ class NativeSession {
|
|
|
168
193
|
process.once('SIGINT', this.cancel);
|
|
169
194
|
process.once('SIGTERM', this.cancel);
|
|
170
195
|
}
|
|
171
|
-
async preview(command) {
|
|
196
|
+
async preview(command, positionMs) {
|
|
172
197
|
const id = ++this.sequence;
|
|
173
198
|
let timer;
|
|
174
199
|
try {
|
|
@@ -176,7 +201,7 @@ class NativeSession {
|
|
|
176
201
|
return await new Promise((resolve, reject) => {
|
|
177
202
|
this.pending.set(id, { resolve, reject });
|
|
178
203
|
timer = setTimeout(() => { this.pending.delete(id); reject(new ProductionError('POWERPOINT_TIMEOUT', 'Native preview did not respond within 15 seconds', 5)); }, 15000);
|
|
179
|
-
this.child.stdin.write(`${JSON.stringify({ id, command })}\n`, error => { if (error) {
|
|
204
|
+
this.child.stdin.write(`${JSON.stringify({ id, command, ...(positionMs !== undefined ? { position_ms: positionMs } : {}) })}\n`, error => { if (error) {
|
|
180
205
|
this.pending.delete(id);
|
|
181
206
|
reject(error);
|
|
182
207
|
} });
|
|
@@ -352,7 +377,7 @@ export class PowerPointAdapter {
|
|
|
352
377
|
}),
|
|
353
378
|
} : {}),
|
|
354
379
|
files: [resolve(file), helper, packagePath('tools', 'powerpoint', 'Native.cs'), fileURLToPath(import.meta.url)],
|
|
355
|
-
capabilities: ['slide', 'reveal', 'play', 'highlight:region', 'highlight:shape', 'underline:region', 'underline:shape'],
|
|
380
|
+
capabilities: ['slide', 'reveal', 'play', 'highlight:region', 'highlight:shape', 'highlight:text', 'underline:region', 'underline:shape', 'underline:text', 'spotlight:region', 'spotlight:shape', 'spotlight:text', 'zoom:region', 'zoom:shape', 'zoom:text', 'laser:path', 'laser:region', 'laser:shape', 'laser:text', 'stamp:point', 'stamp:region', 'stamp:shape', 'stamp:text'],
|
|
356
381
|
...(unsupported.length ? { unsupported } : {}),
|
|
357
382
|
annotation_targets: this.targets(),
|
|
358
383
|
};
|
|
@@ -364,7 +389,18 @@ export class PowerPointAdapter {
|
|
|
364
389
|
}
|
|
365
390
|
}
|
|
366
391
|
targets() {
|
|
367
|
-
return this.deck.slides.map(slide => ({
|
|
392
|
+
return this.deck.slides.map(slide => ({
|
|
393
|
+
slide: slide.id || `slide-${slide.native_id}`,
|
|
394
|
+
clicks: slide.clicks.length,
|
|
395
|
+
targets: slide.shapes.map(shape => {
|
|
396
|
+
const textPreview = shape.text ? ` Text: ${JSON.stringify(shape.text.slice(0, 120))}` : '';
|
|
397
|
+
const textIssues = shape.text_unsupported?.length ? ` (text-range unsupported: ${shape.text_unsupported.join('; ')})` : '';
|
|
398
|
+
return {
|
|
399
|
+
identity: String(shape.id),
|
|
400
|
+
description: `Slide ${slide.index} (native ${slide.native_id}), shape ${shape.id}: ${shape.name}. ${shape.unsupported.length ? `Unsupported: ${shape.unsupported.join('; ')}` : `Stationary whole shape, visible from click ${shape.visible_from_click}`}${textPreview}${textIssues}`,
|
|
401
|
+
};
|
|
402
|
+
}),
|
|
403
|
+
}));
|
|
368
404
|
}
|
|
369
405
|
async inspectTargets(_deck, _viewport) {
|
|
370
406
|
requireCondition(this.deck, 'POWERPOINT_INSPECTION', 'Inspect the native deck before discovering annotation targets', 3);
|
|
@@ -412,18 +448,66 @@ export class PowerPointAdapter {
|
|
|
412
448
|
if (action.type === 'play')
|
|
413
449
|
requireCondition((action.rate ?? 1) === 1, 'POWERPOINT_CAPABILITY', `Video action ${action.id} requires playback rate 1 in native PowerPoint playback`, 3);
|
|
414
450
|
}
|
|
415
|
-
for (const annotation of story.annotations)
|
|
416
|
-
|
|
451
|
+
for (const annotation of story.annotations) {
|
|
452
|
+
const targets = annotation.target.type === 'path'
|
|
453
|
+
? annotation.target.points.flatMap(point => 'target' in point ? [point.target] : [])
|
|
454
|
+
: [annotation.target];
|
|
455
|
+
for (const target of targets) {
|
|
456
|
+
requireCondition(target.type !== 'element' && !(target.type === 'text' && target.container?.type === 'element'), 'ANNOTATION_TARGET', `Annotation ${annotation.id} uses a Slidev selector. PowerPoint requires an existing shape ID, text target, or normalized region.`, 3);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
417
459
|
if (schedule) {
|
|
418
460
|
this.operations(story, schedule);
|
|
419
461
|
for (const annotation of schedule.annotations) {
|
|
420
462
|
const slide = this.slide(annotation.slide);
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
463
|
+
const targets = annotation.target.type === 'path'
|
|
464
|
+
? annotation.target.points.flatMap(point => 'target' in point ? [point.target] : [])
|
|
465
|
+
: [annotation.target];
|
|
466
|
+
for (const target of targets) {
|
|
467
|
+
if (target.type === 'shape') {
|
|
468
|
+
const candidates = slide.shapes.filter(shape => shape.id === target.id);
|
|
469
|
+
requireCondition(candidates.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: shape ${target.id} is missing or ambiguous`, 3);
|
|
470
|
+
const shape = candidates[0];
|
|
471
|
+
requireCondition(shape.unsupported.length === 0 && annotation.click >= shape.visible_from_click, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}, shape ${shape.id} (${shape.name}): ${shape.unsupported.join('; ') || `hidden until click ${shape.visible_from_click}`}`, 3);
|
|
472
|
+
}
|
|
473
|
+
if (target.type === 'text') {
|
|
474
|
+
const needle = target.text.trim().replace(/\s+/g, ' ');
|
|
475
|
+
let shapes;
|
|
476
|
+
if (target.container) {
|
|
477
|
+
requireCondition(target.container.type === 'shape', 'ANNOTATION_TARGET', `Annotation ${annotation.id}: PowerPoint text container requires a shape ID`, 3);
|
|
478
|
+
const containerId = target.container.id;
|
|
479
|
+
const candidates = slide.shapes.filter(shape => shape.id === containerId);
|
|
480
|
+
requireCondition(candidates.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: shape ${containerId} is missing or ambiguous`, 3);
|
|
481
|
+
const shape = candidates[0];
|
|
482
|
+
const issues = [...shape.unsupported, ...(shape.text_unsupported ?? [])];
|
|
483
|
+
requireCondition(issues.length === 0 && annotation.click >= shape.visible_from_click && Boolean(shape.text), 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}, shape ${shape.id} (${shape.name}): ${issues.join('; ') || (annotation.click < shape.visible_from_click ? `hidden until click ${shape.visible_from_click}` : 'shape contains no text')}`, 3);
|
|
484
|
+
shapes = [shape];
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
shapes = slide.shapes.filter(shape => shape.unsupported.length === 0 && (shape.text_unsupported ?? []).length === 0 && annotation.click >= shape.visible_from_click && Boolean(shape.text));
|
|
488
|
+
}
|
|
489
|
+
const matches = [];
|
|
490
|
+
for (const shape of shapes) {
|
|
491
|
+
const text = shape.text ?? '';
|
|
492
|
+
let pos = text.indexOf(needle);
|
|
493
|
+
while (pos >= 0) {
|
|
494
|
+
matches.push({ shape, pos });
|
|
495
|
+
pos = text.indexOf(needle, pos + 1);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (matches.length === 0) {
|
|
499
|
+
const unsupportedMatch = !target.container
|
|
500
|
+
? slide.shapes.find(shape => shape.unsupported.length === 0 && (shape.text_unsupported ?? []).length > 0 && annotation.click >= shape.visible_from_click && (shape.text ?? '').includes(needle))
|
|
501
|
+
: undefined;
|
|
502
|
+
const detail = unsupportedMatch
|
|
503
|
+
? `shape ${unsupportedMatch.id} (${unsupportedMatch.name}): ${(unsupportedMatch.text_unsupported ?? []).join('; ')}`
|
|
504
|
+
: `text ${JSON.stringify(needle)} not found in visible supported shapes`;
|
|
505
|
+
requireCondition(false, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: ${detail}`, 3);
|
|
506
|
+
}
|
|
507
|
+
requireCondition(target.occurrence !== undefined || matches.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: text ${JSON.stringify(needle)} matched ${matches.length} times; specify container or occurrence`, 3);
|
|
508
|
+
const selected = matches[(target.occurrence ?? 1) - 1];
|
|
509
|
+
requireCondition(selected !== undefined, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: text occurrence ${target.occurrence} does not exist`, 3);
|
|
510
|
+
}
|
|
427
511
|
}
|
|
428
512
|
}
|
|
429
513
|
}
|
|
@@ -492,7 +576,7 @@ export class PowerPointAdapter {
|
|
|
492
576
|
}
|
|
493
577
|
async startPreview(story, schedule, directory, _parentOrigin, viewport = defaultViewport) {
|
|
494
578
|
await this.openPlayback(story, schedule, directory, 'preview', { ...viewport, fps: defaultVideoOutput.fps }, false);
|
|
495
|
-
return nativePreview(command => this.session.preview(command));
|
|
579
|
+
return nativePreview((command, positionMs) => this.session.preview(command, positionMs));
|
|
496
580
|
}
|
|
497
581
|
async openPlayback(story, schedule, directory, mode, output, verifyTiming) {
|
|
498
582
|
requireCondition(this.deck, 'POWERPOINT_INSPECTION', 'Inspect the native deck before playback', 3);
|
|
@@ -513,8 +597,11 @@ export class PowerPointAdapter {
|
|
|
513
597
|
});
|
|
514
598
|
const request = join(directory, 'request.json');
|
|
515
599
|
const geometry_requests = geometryRequests(schedule).map(item => ({ ...item, native_id: this.slide(item.slide).native_id }));
|
|
600
|
+
const static_skips = mode === 'record' && !verifyTiming
|
|
601
|
+
? planStaticSkips(operations.map(operation => ({ start_ms: operation.at_ms, end_ms: operation.end_ms })), geometry_requests.flatMap(item => [item.start_ms, item.end_ms]), schedule.duration_ms)
|
|
602
|
+
: [];
|
|
516
603
|
const capture = mode === 'record' ? { ffmpeg: executable('ffmpeg'), ffprobe: executable('ffprobe') } : {};
|
|
517
|
-
await saveJson(request, { version: 1, mode, directory, deck: story.deck, deck_sha256: this.deck.deck_sha256, parent_pid: process.pid, operations, geometry_requests, media, output, duration_ms: schedule.duration_ms, verify_timing: verifyTiming, ...capture });
|
|
604
|
+
await saveJson(request, { version: 1, mode, directory, deck: story.deck, deck_sha256: this.deck.deck_sha256, parent_pid: process.pid, operations, geometry_requests, media, output, duration_ms: schedule.duration_ms, verify_timing: verifyTiming, static_skips, ...capture });
|
|
518
605
|
this.session = new NativeSession(directory, request);
|
|
519
606
|
await this.session.waitFor('prepared.json', hasStageDeadline() ? undefined : 120000);
|
|
520
607
|
}
|
|
@@ -528,7 +615,12 @@ export class PowerPointAdapter {
|
|
|
528
615
|
requireCondition(properties.width === production.output.width && properties.height === production.output.height && !properties.has_audio, 'CAPTURE_DIMENSIONS', 'Native capture must contain the requested audience dimensions and no audio', 5);
|
|
529
616
|
progress?.(production.verify_timing ? 'Verifying captured timing' : 'Locating capture origin; per-cue timing verification skipped');
|
|
530
617
|
const timing = production.verify_timing ? await calibrate(observed.file, observed.markers, observed.references, schedule.duration_ms, directory) : await estimateOrigin(observed.file, observed.markers, schedule.duration_ms, directory);
|
|
531
|
-
|
|
618
|
+
let finalProperties = properties;
|
|
619
|
+
if (!production.verify_timing && observed.applied_skips?.length) {
|
|
620
|
+
await remapCaptureTimestamps(observed.file, timing.mapping.offset_ms, observed.applied_skips);
|
|
621
|
+
finalProperties = await probe(observed.file);
|
|
622
|
+
}
|
|
623
|
+
const visual = { version: 1, file: observed.file, properties: finalProperties, events: observed.events, ...(observed.annotation_geometry.length ? { annotation_geometry: observed.annotation_geometry } : {}), origin: { method: production.verify_timing ? 'decoded_markers' : 'opening_markers', uncertainty_ms: timing.uncertainty_ms, mapping: timing.mapping }, timing, provenance: { adapter: this.id, version: this.version, dependencies: observed.dependencies } };
|
|
532
624
|
await saveJson(join(directory, 'visual.json'), visual);
|
|
533
625
|
requireCondition(!production.verify_timing || timing.status === 'accepted', 'TIMING_ACCEPTANCE', 'Native capture completed but decoded timing evidence failed. See calibration.json.', 6);
|
|
534
626
|
return visual;
|
|
@@ -42,7 +42,7 @@ export async function inspectSlidev(deck) {
|
|
|
42
42
|
}));
|
|
43
43
|
requireCondition(new Set(slides.map(s => s.id)).size === slides.length, 'SLIDE_ID', 'Slide names must be unique');
|
|
44
44
|
const media_ids = parsed.slides.flatMap(slide => [...slide.content.matchAll(/<(?:video|audio)\b[^>]*\bid=["']([^"']+)["']/g)].map(match => match[1]));
|
|
45
|
-
return { slides, media_ids, files: await slidevInputs(deck, parsed.headmatter, parsed.files), capabilities: ['slide', 'reveal', 'play', 'highlight:region', 'highlight:element', 'underline:region', 'underline:element'] };
|
|
45
|
+
return { slides, media_ids, files: await slidevInputs(deck, parsed.headmatter, parsed.files), capabilities: ['slide', 'reveal', 'play', 'highlight:region', 'highlight:element', 'highlight:text', 'underline:region', 'underline:element', 'underline:text', 'spotlight:region', 'spotlight:element', 'spotlight:text', 'zoom:region', 'zoom:element', 'zoom:text', 'laser:path', 'laser:region', 'laser:element', 'laser:text', 'stamp:point', 'stamp:region', 'stamp:element', 'stamp:text'] };
|
|
46
46
|
}
|
|
47
47
|
export function validateSlidev(story, inspection, options) {
|
|
48
48
|
const schedule = options?.schedule;
|
|
@@ -50,7 +50,12 @@ export function validateSlidev(story, inspection, options) {
|
|
|
50
50
|
requireCondition(inspection.slides.some(s => s.id === scene.slide), 'SLIDE_REFERENCE', `Scene ${scene.id} has unknown slide ${scene.slide}`);
|
|
51
51
|
}
|
|
52
52
|
for (const annotation of story.annotations) {
|
|
53
|
-
|
|
53
|
+
const targets = annotation.target.type === 'path'
|
|
54
|
+
? annotation.target.points.flatMap(point => 'target' in point ? [point.target] : [])
|
|
55
|
+
: [annotation.target];
|
|
56
|
+
for (const target of targets) {
|
|
57
|
+
requireCondition(target.type !== 'shape' && !(target.type === 'text' && target.container?.type === 'shape'), 'ANNOTATION_TARGET', `Annotation ${annotation.id} uses a PowerPoint shape target unsupported by Slidev`, 3, { annotation: annotation.id });
|
|
58
|
+
}
|
|
54
59
|
}
|
|
55
60
|
const actions = [...story.scenes.flatMap(s => s.actions), ...story.cues.map(c => ({ ...c.action, id: c.id }))];
|
|
56
61
|
for (const action of actions) {
|
package/dist/adapters/slidev.js
CHANGED
|
@@ -8,6 +8,7 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { defaultVideoOutput } from '../contracts.js';
|
|
10
10
|
import { geometryRequests } from '../annotation-paint.js';
|
|
11
|
+
import { planStaticSkips, remapCaptureTimestamps } from './capture-compression.js';
|
|
11
12
|
import { inspectSlidev, validateSlidev } from './slidev-inspection.js';
|
|
12
13
|
import { calibrate, estimateOrigin } from '../calibration.js';
|
|
13
14
|
import { execute, probe, saveJson, hashFile, digest, videoFramePeriod, executionSignal } from '../media.js';
|
|
@@ -156,9 +157,351 @@ export class SlidevAdapter {
|
|
|
156
157
|
this.page = await this.browser.newPage({ viewport: { width: viewport.width, height: viewport.height }, deviceScaleFactor: 1, acceptDownloads: false });
|
|
157
158
|
this.page.setDefaultNavigationTimeout(120000);
|
|
158
159
|
this.page.on('pageerror', error => { this.log += `\nBrowser error: ${error.message}`; });
|
|
160
|
+
const inFlightRequests = new Set();
|
|
161
|
+
const serverOrigin = new URL(url).origin;
|
|
162
|
+
const isInternalCaptureRequest = (requestUrl) => {
|
|
163
|
+
try {
|
|
164
|
+
const parsed = new URL(requestUrl);
|
|
165
|
+
return parsed.origin === serverOrigin && (parsed.pathname === '/__slidevideo_capture' || parsed.pathname === '/__slidevideo_preview');
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
this.page.on('request', request => {
|
|
172
|
+
if (!isInternalCaptureRequest(request.url()))
|
|
173
|
+
inFlightRequests.add(request);
|
|
174
|
+
});
|
|
175
|
+
this.page.on('requestfinished', request => { inFlightRequests.delete(request); });
|
|
176
|
+
this.page.on('requestfailed', request => { inFlightRequests.delete(request); });
|
|
177
|
+
await this.page.exposeFunction('__slidevideoHasInFlightRequests', () => inFlightRequests.size > 0);
|
|
159
178
|
await this.page.addInitScript(() => {
|
|
160
179
|
localStorage.setItem('slidev-camera', 'none');
|
|
161
180
|
localStorage.setItem('slidev-mic', 'none');
|
|
181
|
+
const nativeSetTimeout = window.setTimeout.bind(window);
|
|
182
|
+
const nativeClearTimeout = window.clearTimeout.bind(window);
|
|
183
|
+
const nativeSetInterval = window.setInterval.bind(window);
|
|
184
|
+
const nativeClearInterval = window.clearInterval.bind(window);
|
|
185
|
+
const nativeRequestAnimationFrame = window.requestAnimationFrame.bind(window);
|
|
186
|
+
const nativeCancelAnimationFrame = window.cancelAnimationFrame.bind(window);
|
|
187
|
+
const pendingTimeouts = new Set();
|
|
188
|
+
const stringTimeoutCleanups = new Map();
|
|
189
|
+
const activeIntervals = new Set();
|
|
190
|
+
const pendingAnimationFrames = new Set();
|
|
191
|
+
const pendingIdleCallbacks = new Set();
|
|
192
|
+
const activeExternalSources = new Set();
|
|
193
|
+
const shadowHosts = new WeakSet();
|
|
194
|
+
let pendingAsync = 0;
|
|
195
|
+
if (typeof Element !== 'undefined' && typeof Element.prototype.attachShadow === 'function') {
|
|
196
|
+
const nativeAttachShadow = Element.prototype.attachShadow;
|
|
197
|
+
Element.prototype.attachShadow = function (init) {
|
|
198
|
+
shadowHosts.add(this);
|
|
199
|
+
return nativeAttachShadow.call(this, init);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const isFrameworkCaller = () => {
|
|
203
|
+
const frames = (new Error().stack ?? '').split('\n').slice(1).map(line => line.trim());
|
|
204
|
+
const caller = frames[2] ?? '';
|
|
205
|
+
return /\/@vite\/client|\/node_modules\/(?:@slidev\/|vue\/|@vue\/|\.vite\/deps\/(?:vue|vue-router|@vue_[^/?]+|@slidev_[^/?]+)\.js(?:[?:#]|$))|\/addons\/slidevideo\//.test(caller);
|
|
206
|
+
};
|
|
207
|
+
let internalDepth = 0;
|
|
208
|
+
window.setTimeout = ((handler, timeout, ...args) => {
|
|
209
|
+
if (internalDepth > 0 || isFrameworkCaller())
|
|
210
|
+
return nativeSetTimeout(handler, timeout, ...args);
|
|
211
|
+
let id = 0;
|
|
212
|
+
if (typeof handler === 'function') {
|
|
213
|
+
const wrapped = (...cbArgs) => { pendingTimeouts.delete(id); return handler.apply(window, cbArgs); };
|
|
214
|
+
id = nativeSetTimeout(wrapped, timeout, ...args);
|
|
215
|
+
pendingTimeouts.add(id);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
id = nativeSetTimeout(handler, timeout, ...args);
|
|
219
|
+
pendingTimeouts.add(id);
|
|
220
|
+
const delay = Math.max(0, Number(timeout) || 0) + 50;
|
|
221
|
+
const cleanupId = nativeSetTimeout(() => { pendingTimeouts.delete(id); stringTimeoutCleanups.delete(id); }, delay);
|
|
222
|
+
stringTimeoutCleanups.set(id, cleanupId);
|
|
223
|
+
}
|
|
224
|
+
return id;
|
|
225
|
+
});
|
|
226
|
+
const clearTrackedTimer = (id) => {
|
|
227
|
+
if (id === undefined || id === null)
|
|
228
|
+
return;
|
|
229
|
+
const numericId = Number(id);
|
|
230
|
+
if (!Number.isFinite(numericId))
|
|
231
|
+
return;
|
|
232
|
+
pendingTimeouts.delete(numericId);
|
|
233
|
+
activeIntervals.delete(numericId);
|
|
234
|
+
const cleanupId = stringTimeoutCleanups.get(numericId);
|
|
235
|
+
if (cleanupId !== undefined) {
|
|
236
|
+
nativeClearTimeout(cleanupId);
|
|
237
|
+
stringTimeoutCleanups.delete(numericId);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
window.clearTimeout = ((id) => {
|
|
241
|
+
clearTrackedTimer(id);
|
|
242
|
+
return nativeClearTimeout(id);
|
|
243
|
+
});
|
|
244
|
+
window.setInterval = ((handler, timeout, ...args) => {
|
|
245
|
+
if (internalDepth > 0 || isFrameworkCaller())
|
|
246
|
+
return nativeSetInterval(handler, timeout, ...args);
|
|
247
|
+
const id = nativeSetInterval(handler, timeout, ...args);
|
|
248
|
+
activeIntervals.add(id);
|
|
249
|
+
return id;
|
|
250
|
+
});
|
|
251
|
+
window.clearInterval = ((id) => {
|
|
252
|
+
clearTrackedTimer(id);
|
|
253
|
+
return nativeClearInterval(id);
|
|
254
|
+
});
|
|
255
|
+
window.requestAnimationFrame = ((callback) => {
|
|
256
|
+
if (internalDepth > 0 || isFrameworkCaller())
|
|
257
|
+
return nativeRequestAnimationFrame(callback);
|
|
258
|
+
let id = 0;
|
|
259
|
+
id = nativeRequestAnimationFrame((time) => {
|
|
260
|
+
pendingAnimationFrames.delete(id);
|
|
261
|
+
return callback(time);
|
|
262
|
+
});
|
|
263
|
+
pendingAnimationFrames.add(id);
|
|
264
|
+
return id;
|
|
265
|
+
});
|
|
266
|
+
window.cancelAnimationFrame = ((id) => {
|
|
267
|
+
const numericId = Number(id);
|
|
268
|
+
if (Number.isFinite(numericId))
|
|
269
|
+
pendingAnimationFrames.delete(numericId);
|
|
270
|
+
return nativeCancelAnimationFrame(id);
|
|
271
|
+
});
|
|
272
|
+
if (typeof window.requestIdleCallback === 'function' && typeof window.cancelIdleCallback === 'function') {
|
|
273
|
+
const nativeRequestIdleCallback = window.requestIdleCallback.bind(window);
|
|
274
|
+
const nativeCancelIdleCallback = window.cancelIdleCallback.bind(window);
|
|
275
|
+
window.requestIdleCallback = ((callback, options) => {
|
|
276
|
+
if (internalDepth > 0 || isFrameworkCaller())
|
|
277
|
+
return nativeRequestIdleCallback(callback, options);
|
|
278
|
+
let id = 0;
|
|
279
|
+
id = nativeRequestIdleCallback((deadline) => {
|
|
280
|
+
pendingIdleCallbacks.delete(id);
|
|
281
|
+
return callback(deadline);
|
|
282
|
+
}, options);
|
|
283
|
+
pendingIdleCallbacks.add(id);
|
|
284
|
+
return id;
|
|
285
|
+
});
|
|
286
|
+
window.cancelIdleCallback = ((id) => {
|
|
287
|
+
const numericId = Number(id);
|
|
288
|
+
if (Number.isFinite(numericId))
|
|
289
|
+
pendingIdleCallbacks.delete(numericId);
|
|
290
|
+
return nativeCancelIdleCallback(id);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
if (typeof window.fetch === 'function') {
|
|
294
|
+
const nativeFetch = window.fetch.bind(window);
|
|
295
|
+
const bodyMethods = ['arrayBuffer', 'blob', 'bytes', 'formData', 'json', 'text'];
|
|
296
|
+
const trackStream = (stream) => {
|
|
297
|
+
if (!stream)
|
|
298
|
+
return;
|
|
299
|
+
const record = stream;
|
|
300
|
+
if (typeof record.getReader === 'function') {
|
|
301
|
+
const origGetReader = record.getReader.bind(stream);
|
|
302
|
+
record.getReader = (...readerArgs) => {
|
|
303
|
+
const reader = origGetReader(...readerArgs);
|
|
304
|
+
if (reader && typeof reader.read === 'function') {
|
|
305
|
+
const origRead = reader.read.bind(reader);
|
|
306
|
+
reader.read = (...readArgs) => {
|
|
307
|
+
pendingAsync++;
|
|
308
|
+
return Promise.resolve(origRead(...readArgs)).finally(() => { pendingAsync--; });
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return reader;
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (typeof record.pipeTo === 'function') {
|
|
315
|
+
const origPipeTo = record.pipeTo.bind(stream);
|
|
316
|
+
record.pipeTo = (...pipeArgs) => {
|
|
317
|
+
pendingAsync++;
|
|
318
|
+
return Promise.resolve(origPipeTo(...pipeArgs)).finally(() => { pendingAsync--; });
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
if (typeof record.pipeThrough === 'function') {
|
|
322
|
+
const origPipeThrough = record.pipeThrough.bind(stream);
|
|
323
|
+
record.pipeThrough = (...pipeArgs) => {
|
|
324
|
+
const derived = origPipeThrough(...pipeArgs);
|
|
325
|
+
trackStream(derived);
|
|
326
|
+
return derived;
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
if (typeof record.tee === 'function') {
|
|
330
|
+
const origTee = record.tee.bind(stream);
|
|
331
|
+
record.tee = () => {
|
|
332
|
+
const branches = origTee();
|
|
333
|
+
for (const branch of branches)
|
|
334
|
+
trackStream(branch);
|
|
335
|
+
return branches;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
for (const key of [Symbol.asyncIterator, 'values']) {
|
|
339
|
+
if (typeof record[key] !== 'function')
|
|
340
|
+
continue;
|
|
341
|
+
const origIter = record[key].bind(stream);
|
|
342
|
+
record[key] = (...iterArgs) => {
|
|
343
|
+
const iterator = origIter(...iterArgs);
|
|
344
|
+
if (iterator && typeof iterator.next === 'function') {
|
|
345
|
+
const origNext = iterator.next.bind(iterator);
|
|
346
|
+
iterator.next = () => {
|
|
347
|
+
pendingAsync++;
|
|
348
|
+
return Promise.resolve(origNext()).finally(() => { pendingAsync--; });
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
return iterator;
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
const trackResponse = (response) => {
|
|
356
|
+
const record = response;
|
|
357
|
+
for (const method of bodyMethods) {
|
|
358
|
+
const orig = record[method];
|
|
359
|
+
if (typeof orig !== 'function')
|
|
360
|
+
continue;
|
|
361
|
+
record[method] = function (...bodyArgs) {
|
|
362
|
+
pendingAsync++;
|
|
363
|
+
return Promise.resolve(orig.apply(this, bodyArgs)).finally(() => { pendingAsync--; });
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
if (typeof record.clone === 'function') {
|
|
367
|
+
const origClone = record.clone.bind(response);
|
|
368
|
+
record.clone = () => trackResponse(origClone());
|
|
369
|
+
}
|
|
370
|
+
trackStream(response.body);
|
|
371
|
+
return response;
|
|
372
|
+
};
|
|
373
|
+
const isInternalEndpoint = (requestUrl) => {
|
|
374
|
+
try {
|
|
375
|
+
const parsed = new URL(requestUrl, location.href);
|
|
376
|
+
return parsed.origin === location.origin && (parsed.pathname === '/__slidevideo_capture' || parsed.pathname === '/__slidevideo_preview');
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
window.fetch = ((input, init) => {
|
|
383
|
+
const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
|
|
384
|
+
if (internalDepth > 0 || isInternalEndpoint(url) || isFrameworkCaller())
|
|
385
|
+
return nativeFetch(input, init);
|
|
386
|
+
pendingAsync++;
|
|
387
|
+
return nativeFetch(input, init).then(trackResponse).finally(() => { pendingAsync--; });
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
if (typeof XMLHttpRequest !== 'undefined') {
|
|
391
|
+
const nativeSend = XMLHttpRequest.prototype.send;
|
|
392
|
+
XMLHttpRequest.prototype.send = function (body) {
|
|
393
|
+
if (internalDepth === 0 && !isFrameworkCaller()) {
|
|
394
|
+
let settled = false;
|
|
395
|
+
const release = () => { if (!settled) {
|
|
396
|
+
settled = true;
|
|
397
|
+
pendingAsync--;
|
|
398
|
+
} };
|
|
399
|
+
pendingAsync++;
|
|
400
|
+
this.addEventListener('loadend', release, { once: true });
|
|
401
|
+
try {
|
|
402
|
+
return nativeSend.call(this, body);
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
this.removeEventListener('loadend', release);
|
|
406
|
+
release();
|
|
407
|
+
throw error;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return nativeSend.call(this, body);
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
if (typeof IDBFactory !== 'undefined') {
|
|
414
|
+
for (const method of ['open', 'deleteDatabase']) {
|
|
415
|
+
const orig = IDBFactory.prototype[method];
|
|
416
|
+
if (typeof orig !== 'function')
|
|
417
|
+
continue;
|
|
418
|
+
IDBFactory.prototype[method] = function (...idbArgs) {
|
|
419
|
+
const request = orig.apply(this, idbArgs);
|
|
420
|
+
if (!isFrameworkCaller() && request && typeof request.addEventListener === 'function') {
|
|
421
|
+
let settled = false;
|
|
422
|
+
const release = () => { if (!settled) {
|
|
423
|
+
settled = true;
|
|
424
|
+
pendingAsync--;
|
|
425
|
+
} };
|
|
426
|
+
pendingAsync++;
|
|
427
|
+
request.addEventListener('success', release, { once: true });
|
|
428
|
+
request.addEventListener('error', release, { once: true });
|
|
429
|
+
}
|
|
430
|
+
return request;
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (typeof IDBDatabase !== 'undefined' && typeof IDBDatabase.prototype.transaction === 'function') {
|
|
435
|
+
const origTx = IDBDatabase.prototype.transaction;
|
|
436
|
+
IDBDatabase.prototype.transaction = function (...txArgs) {
|
|
437
|
+
const tx = origTx.apply(this, txArgs);
|
|
438
|
+
if (!isFrameworkCaller() && tx && typeof tx.addEventListener === 'function') {
|
|
439
|
+
let settled = false;
|
|
440
|
+
const release = () => { if (!settled) {
|
|
441
|
+
settled = true;
|
|
442
|
+
pendingAsync--;
|
|
443
|
+
} };
|
|
444
|
+
pendingAsync++;
|
|
445
|
+
tx.addEventListener('complete', release, { once: true });
|
|
446
|
+
tx.addEventListener('abort', release, { once: true });
|
|
447
|
+
tx.addEventListener('error', release, { once: true });
|
|
448
|
+
}
|
|
449
|
+
return tx;
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
for (const name of ['Worker', 'WebSocket', 'EventSource']) {
|
|
453
|
+
const NativeCtor = window[name];
|
|
454
|
+
if (typeof NativeCtor !== 'function')
|
|
455
|
+
continue;
|
|
456
|
+
window[name] = new Proxy(NativeCtor, {
|
|
457
|
+
construct(target, args, newTarget) {
|
|
458
|
+
const track = !isFrameworkCaller();
|
|
459
|
+
const instance = Reflect.construct(target, args, newTarget);
|
|
460
|
+
if (track) {
|
|
461
|
+
activeExternalSources.add(instance);
|
|
462
|
+
const release = () => { activeExternalSources.delete(instance); };
|
|
463
|
+
if (name === 'Worker' && typeof instance.terminate === 'function') {
|
|
464
|
+
const orig = instance.terminate.bind(instance);
|
|
465
|
+
instance.terminate = () => { release(); return orig(); };
|
|
466
|
+
}
|
|
467
|
+
if (name === 'EventSource' && typeof instance.close === 'function') {
|
|
468
|
+
const orig = instance.close.bind(instance);
|
|
469
|
+
instance.close = (...closeArgs) => { release(); return orig(...closeArgs); };
|
|
470
|
+
}
|
|
471
|
+
if (name === 'WebSocket' && typeof instance.addEventListener === 'function') {
|
|
472
|
+
instance.addEventListener('close', release, { once: true });
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return instance;
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
window.__slidevideoTimers = {
|
|
480
|
+
hasPending: () => pendingTimeouts.size > 0 || activeIntervals.size > 0 || pendingAnimationFrames.size > 0 || pendingIdleCallbacks.size > 0 || pendingAsync > 0 || activeExternalSources.size > 0,
|
|
481
|
+
hasShadowHost: (root) => {
|
|
482
|
+
if (root.shadowRoot || shadowHosts.has(root))
|
|
483
|
+
return true;
|
|
484
|
+
for (const element of root.querySelectorAll('*')) {
|
|
485
|
+
if (element.shadowRoot || shadowHosts.has(element))
|
|
486
|
+
return true;
|
|
487
|
+
}
|
|
488
|
+
return false;
|
|
489
|
+
},
|
|
490
|
+
setInternalTimeout: (callback, ms) => { internalDepth++; try {
|
|
491
|
+
return nativeSetTimeout(callback, ms);
|
|
492
|
+
}
|
|
493
|
+
finally {
|
|
494
|
+
internalDepth--;
|
|
495
|
+
} },
|
|
496
|
+
clearInternalTimeout: id => nativeClearTimeout(id),
|
|
497
|
+
setInternalInterval: (callback, ms) => { internalDepth++; try {
|
|
498
|
+
return nativeSetInterval(callback, ms);
|
|
499
|
+
}
|
|
500
|
+
finally {
|
|
501
|
+
internalDepth--;
|
|
502
|
+
} },
|
|
503
|
+
clearInternalInterval: id => nativeClearInterval(id),
|
|
504
|
+
};
|
|
162
505
|
});
|
|
163
506
|
await this.page.goto(`${url}/1?slidevideo=1`);
|
|
164
507
|
await this.page.waitForFunction(() => Boolean(window.__slidevideo), { timeout: 120000 });
|
|
@@ -390,9 +733,20 @@ export class SlidevAdapter {
|
|
|
390
733
|
try {
|
|
391
734
|
progress?.('Recording presentation');
|
|
392
735
|
const page = this.page;
|
|
736
|
+
const plannedSkips = this.production.verify_timing
|
|
737
|
+
? []
|
|
738
|
+
: planStaticSkips(this.schedule.actions.reduce((windows, item) => {
|
|
739
|
+
if (item.action.type === 'slide' || item.action.type === 'reveal') {
|
|
740
|
+
windows.push({ start_ms: item.start_ms, end_ms: item.start_ms + Math.max(0, item.action.duration_ms) });
|
|
741
|
+
}
|
|
742
|
+
else if (item.action.type === 'play') {
|
|
743
|
+
windows.push({ start_ms: item.start_ms, end_ms: item.end_ms });
|
|
744
|
+
}
|
|
745
|
+
return windows;
|
|
746
|
+
}, []), geometryRequests(this.schedule).flatMap(request => [request.start_ms, request.end_ms]), this.schedule.duration_ms);
|
|
393
747
|
let playbackError;
|
|
394
748
|
try {
|
|
395
|
-
await page.evaluate(verify => window.__slidevideo.play(verify), this.production.verify_timing);
|
|
749
|
+
await page.evaluate(({ verify, skips }) => window.__slidevideo.play(verify, skips), { verify: this.production.verify_timing, skips: plannedSkips });
|
|
396
750
|
}
|
|
397
751
|
catch (error) {
|
|
398
752
|
playbackError = error;
|
|
@@ -403,7 +757,7 @@ export class SlidevAdapter {
|
|
|
403
757
|
}
|
|
404
758
|
let observed;
|
|
405
759
|
try {
|
|
406
|
-
observed = await page.evaluate(() => ({ events: window.__slidevideo.state.events, markers: window.__slidevideo.state.markers, failure: window.__slidevideo.state.failure, annotation_geometry: window.__slidevideo.state.annotation_geometry }));
|
|
760
|
+
observed = await page.evaluate(() => ({ events: window.__slidevideo.state.events, markers: window.__slidevideo.state.markers, failure: window.__slidevideo.state.failure, annotation_geometry: window.__slidevideo.state.annotation_geometry, applied_skips: window.__slidevideo.state.applied_skips }));
|
|
407
761
|
}
|
|
408
762
|
catch (error) {
|
|
409
763
|
if (!playbackError)
|
|
@@ -466,7 +820,12 @@ export class SlidevAdapter {
|
|
|
466
820
|
const timing = this.production.verify_timing
|
|
467
821
|
? await calibrate(file, observed.markers, this.references, this.schedule.duration_ms, this.directory)
|
|
468
822
|
: await estimateOrigin(file, observed.markers, this.schedule.duration_ms, this.directory);
|
|
469
|
-
|
|
823
|
+
let finalProperties = properties;
|
|
824
|
+
if (!this.production.verify_timing && observed.applied_skips?.length) {
|
|
825
|
+
await remapCaptureTimestamps(file, timing.mapping.offset_ms, observed.applied_skips);
|
|
826
|
+
finalProperties = await probe(file);
|
|
827
|
+
}
|
|
828
|
+
const visual = { version: 1, file, ...(expectedGeometry ? { annotation_geometry: observed.annotation_geometry ?? [] } : {}), properties: finalProperties, events: observed.events, origin: { method: this.production.verify_timing ? 'decoded_markers' : 'opening_markers', uncertainty_ms: timing.uncertainty_ms, mapping: timing.mapping }, timing, provenance: { adapter: this.id, version: this.version, dependencies: { chromium: this.browser.version(), slidev: '53.1.0', playwright: '1.65.1' } } };
|
|
470
829
|
await saveJson(join(this.directory, 'visual.json'), visual);
|
|
471
830
|
requireCondition(!this.production.verify_timing || timing.status === 'accepted', 'TIMING_ACCEPTANCE', 'Capture completed but decoded timing evidence failed. See calibration.json.', 6);
|
|
472
831
|
return visual;
|