@hyperframes/engine 0.6.119 → 0.6.121
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/package.json +24 -7
- package/scripts/generate-lut-reference.py +0 -168
- package/scripts/test-fitTextFontSize-browser.ts +0 -135
- package/src/cdp-headless-experimental.d.ts +0 -54
- package/src/config.test.ts +0 -213
- package/src/config.ts +0 -417
- package/src/index.ts +0 -273
- package/src/services/audioMixer.test.ts +0 -326
- package/src/services/audioMixer.ts +0 -604
- package/src/services/audioMixer.types.ts +0 -35
- package/src/services/audioVolumeEnvelope.test.ts +0 -176
- package/src/services/audioVolumeEnvelope.ts +0 -138
- package/src/services/browserManager.test.ts +0 -330
- package/src/services/browserManager.ts +0 -670
- package/src/services/chunkEncoder.test.ts +0 -1415
- package/src/services/chunkEncoder.ts +0 -831
- package/src/services/chunkEncoder.types.ts +0 -60
- package/src/services/extractionCache.test.ts +0 -199
- package/src/services/extractionCache.ts +0 -216
- package/src/services/fileServer.ts +0 -110
- package/src/services/frameCapture-discardWarmup.test.ts +0 -183
- package/src/services/frameCapture-namePolyfill.test.ts +0 -78
- package/src/services/frameCapture-pollImagesReady.test.ts +0 -153
- package/src/services/frameCapture-staticDedupIndex.test.ts +0 -76
- package/src/services/frameCapture-warmupTicks.test.ts +0 -174
- package/src/services/frameCapture.test.ts +0 -192
- package/src/services/frameCapture.ts +0 -1934
- package/src/services/hdrCapture.test.ts +0 -159
- package/src/services/hdrCapture.ts +0 -315
- package/src/services/parallelCoordinator.test.ts +0 -139
- package/src/services/parallelCoordinator.ts +0 -437
- package/src/services/screenshotService.test.ts +0 -510
- package/src/services/screenshotService.ts +0 -615
- package/src/services/streamingEncoder.test.ts +0 -832
- package/src/services/streamingEncoder.ts +0 -594
- package/src/services/systemMemory.test.ts +0 -324
- package/src/services/systemMemory.ts +0 -180
- package/src/services/videoFrameExtractor.test.ts +0 -1062
- package/src/services/videoFrameExtractor.ts +0 -1139
- package/src/services/videoFrameInjector.test.ts +0 -300
- package/src/services/videoFrameInjector.ts +0 -687
- package/src/services/vp9Options.ts +0 -13
- package/src/types.ts +0 -191
- package/src/utils/alphaBlit.test.ts +0 -1349
- package/src/utils/alphaBlit.ts +0 -1015
- package/src/utils/assertSwiftShader.test.ts +0 -130
- package/src/utils/assertSwiftShader.ts +0 -126
- package/src/utils/ffmpegBinaries.test.ts +0 -43
- package/src/utils/ffmpegBinaries.ts +0 -63
- package/src/utils/ffprobe.test.ts +0 -342
- package/src/utils/ffprobe.ts +0 -457
- package/src/utils/gpuEncoder.test.ts +0 -140
- package/src/utils/gpuEncoder.ts +0 -268
- package/src/utils/hdr.test.ts +0 -191
- package/src/utils/hdr.ts +0 -137
- package/src/utils/hdrCompositing.test.ts +0 -130
- package/src/utils/htmlTemplate.test.ts +0 -42
- package/src/utils/htmlTemplate.ts +0 -42
- package/src/utils/layerCompositor.test.ts +0 -150
- package/src/utils/layerCompositor.ts +0 -58
- package/src/utils/parityContract.ts +0 -1
- package/src/utils/processTracker.test.ts +0 -74
- package/src/utils/processTracker.ts +0 -41
- package/src/utils/readWebGlVendorInfoFromCanvas.ts +0 -52
- package/src/utils/runFfmpeg.test.ts +0 -102
- package/src/utils/runFfmpeg.ts +0 -136
- package/src/utils/shaderTransitions.test.ts +0 -738
- package/src/utils/shaderTransitions.ts +0 -1130
- package/src/utils/uint16-alignment-audit.test.ts +0 -125
- package/src/utils/urlDownloader.test.ts +0 -65
- package/src/utils/urlDownloader.ts +0 -143
- package/tsconfig.json +0 -19
- package/vitest.config.ts +0 -7
package/src/types.ts
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @hyperframes/engine — Protocol Types
|
|
3
|
-
*
|
|
4
|
-
* The engine's page contract. Any web page that wants to be rendered
|
|
5
|
-
* as video must expose `window.__hf` implementing the HfProtocol interface.
|
|
6
|
-
*/
|
|
7
|
-
import type { Fps } from "@hyperframes/core";
|
|
8
|
-
|
|
9
|
-
// ── Seek Protocol ──────────────────────────────────────────────────────────────
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Declares a media element the engine should handle.
|
|
13
|
-
*
|
|
14
|
-
* Headless Chrome in BeginFrame mode cannot play <video> or produce audio.
|
|
15
|
-
* The engine pre-extracts video frames and audio tracks from declared media
|
|
16
|
-
* elements and handles injection/mixing automatically.
|
|
17
|
-
*/
|
|
18
|
-
export interface HfMediaElement {
|
|
19
|
-
/** DOM id of the <video> or <audio> element */
|
|
20
|
-
elementId: string;
|
|
21
|
-
/** Source file path or URL */
|
|
22
|
-
src: string;
|
|
23
|
-
/** When in the composition this element appears (seconds) */
|
|
24
|
-
startTime: number;
|
|
25
|
-
/** When in the composition this element disappears (seconds) */
|
|
26
|
-
endTime: number;
|
|
27
|
-
/** Offset into the source file (seconds, default: 0) */
|
|
28
|
-
mediaOffset?: number;
|
|
29
|
-
/** Audio volume 0-1 (default: 1) */
|
|
30
|
-
volume?: number;
|
|
31
|
-
/** Whether this element has audio that should be extracted */
|
|
32
|
-
hasAudio?: boolean;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Metadata for a shader transition between two scenes.
|
|
37
|
-
*
|
|
38
|
-
* Compositions using @hyperframes/shader-transitions populate
|
|
39
|
-
* `window.__hf.transitions` with one entry per transition so the
|
|
40
|
-
* producer can pre-compute scene ranges, capture per-scene buffers,
|
|
41
|
-
* and apply the transition in HDR-aware compositing.
|
|
42
|
-
*/
|
|
43
|
-
export interface HfTransitionMeta {
|
|
44
|
-
/** Time the transition starts (seconds) */
|
|
45
|
-
time: number;
|
|
46
|
-
/** Transition duration (seconds) */
|
|
47
|
-
duration: number;
|
|
48
|
-
/** Shader identifier. Undefined when the transition is a CSS crossfade. */
|
|
49
|
-
shader?: string;
|
|
50
|
-
/** GSAP easing string (e.g. "power2.inOut") */
|
|
51
|
-
ease: string;
|
|
52
|
-
/** Scene id the transition starts from */
|
|
53
|
-
fromScene: string;
|
|
54
|
-
/** Scene id the transition ends on */
|
|
55
|
-
toScene: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The seek protocol. The only contract between the engine and a page.
|
|
60
|
-
*
|
|
61
|
-
* The engine reads `duration` to calculate total frames, calls `seek(time)`
|
|
62
|
-
* before each frame capture, and uses `media` (if provided) to handle
|
|
63
|
-
* video frame injection and audio mixing.
|
|
64
|
-
*
|
|
65
|
-
* The engine does NOT care what animation framework drives the page.
|
|
66
|
-
* GSAP, Framer Motion, CSS animations, Three.js — anything works as long
|
|
67
|
-
* as `seek()` produces deterministic visual output for a given time.
|
|
68
|
-
*/
|
|
69
|
-
export interface HfProtocol {
|
|
70
|
-
/** Total duration of the composition in seconds */
|
|
71
|
-
duration: number;
|
|
72
|
-
/** Seek to a specific time. Must produce deterministic visual output. */
|
|
73
|
-
seek(time: number): void;
|
|
74
|
-
/** Optional: media elements the engine should handle */
|
|
75
|
-
media?: HfMediaElement[];
|
|
76
|
-
/** Optional: shader transition metadata, populated by @hyperframes/shader-transitions */
|
|
77
|
-
transitions?: HfTransitionMeta[];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// ── Capture Types ──────────────────────────────────────────────────────────────
|
|
81
|
-
|
|
82
|
-
export interface CaptureOptions {
|
|
83
|
-
width: number;
|
|
84
|
-
height: number;
|
|
85
|
-
/**
|
|
86
|
-
* Frame rate as an exact rational. Integer fps is `{ num: 30, den: 1 }`;
|
|
87
|
-
* NTSC is `{ num: 30000, den: 1001 }`. Captures are scheduled by the
|
|
88
|
-
* decimal interval (1000 * den / num ms) but FFmpeg arg builders emit the
|
|
89
|
-
* rational form verbatim — see `fpsToFfmpegArg`.
|
|
90
|
-
*/
|
|
91
|
-
fps: Fps;
|
|
92
|
-
format?: "jpeg" | "png";
|
|
93
|
-
quality?: number;
|
|
94
|
-
deviceScaleFactor?: number;
|
|
95
|
-
/**
|
|
96
|
-
* FFmpeg-probed intrinsic dimensions for videos whose frames are injected
|
|
97
|
-
* out-of-band. Applied before the readiness wait so layout that depends on
|
|
98
|
-
* video aspect ratio (e.g. `height:auto`) stays stable even if Chromium never
|
|
99
|
-
* loads native metadata.
|
|
100
|
-
*/
|
|
101
|
-
videoMetadataHints?: readonly CaptureVideoMetadataHint[];
|
|
102
|
-
/**
|
|
103
|
-
* Video element IDs to exclude from the in-page readiness check that waits
|
|
104
|
-
* for `video.readyState >= 1` before capture starts.
|
|
105
|
-
*
|
|
106
|
-
* Use for videos whose frames are supplied out-of-band, including standard
|
|
107
|
-
* FFmpeg frame injection and native HDR extraction. Pair with
|
|
108
|
-
* `videoMetadataHints` for any skipped video whose CSS layout may depend on
|
|
109
|
-
* intrinsic media dimensions.
|
|
110
|
-
*/
|
|
111
|
-
skipReadinessVideoIds?: readonly string[];
|
|
112
|
-
/**
|
|
113
|
-
* Render-time variable overrides for the composition. The engine injects
|
|
114
|
-
* these as `window.__hfVariables` via `evaluateOnNewDocument` before any
|
|
115
|
-
* page script runs, so the runtime helper `getVariables()` returns the
|
|
116
|
-
* merged result of declared defaults (`data-composition-variables`) and
|
|
117
|
-
* these overrides on its first call.
|
|
118
|
-
*
|
|
119
|
-
* The CLI populates this from `--variables '<json>'` /
|
|
120
|
-
* `--variables-file <path>`. Must be a JSON-serializable plain object.
|
|
121
|
-
*/
|
|
122
|
-
variables?: Record<string, unknown>;
|
|
123
|
-
/**
|
|
124
|
-
* When `true`, the BeginFrame warmup loop driven during page navigation
|
|
125
|
-
* runs exactly `LOCKED_WARMUP_TICKS` (60) iterations regardless of how
|
|
126
|
-
* long the page load takes, making `session.beginFrameTimeTicks`
|
|
127
|
-
* deterministic across machines with different page-load latencies.
|
|
128
|
-
*
|
|
129
|
-
* Default `false`: wall-clock-bounded driver — ticks until page-readiness
|
|
130
|
-
* completes, accumulating whatever count the host CPU manages. Preserves
|
|
131
|
-
* the in-process renderer's BeginFrame timing baselines.
|
|
132
|
-
*
|
|
133
|
-
* Has no effect outside BeginFrame mode (screenshot capture never runs a
|
|
134
|
-
* warmup loop).
|
|
135
|
-
*/
|
|
136
|
-
lockWarmupTicks?: boolean;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export interface CaptureVideoMetadataHint {
|
|
140
|
-
id: string;
|
|
141
|
-
width: number;
|
|
142
|
-
height: number;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface CaptureResult {
|
|
146
|
-
frameIndex: number;
|
|
147
|
-
time: number;
|
|
148
|
-
path: string;
|
|
149
|
-
captureTimeMs: number;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface CaptureBufferResult {
|
|
153
|
-
buffer: Buffer;
|
|
154
|
-
captureTimeMs: number;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export interface CapturePerfSummary {
|
|
158
|
-
frames: number;
|
|
159
|
-
avgTotalMs: number;
|
|
160
|
-
avgSeekMs: number;
|
|
161
|
-
avgBeforeCaptureMs: number;
|
|
162
|
-
avgScreenshotMs: number;
|
|
163
|
-
/**
|
|
164
|
-
* Frames served from the static-dedup cache instead of a real seek+screenshot
|
|
165
|
-
* (opt-out HF_STATIC_DEDUP=false). 0 when dedup was off or never armed. NOT counted
|
|
166
|
-
* in `frames` (reuses are excluded so they don't dilute the per-frame
|
|
167
|
-
* averages) — the captured total this session is `frames + staticDedupReused`.
|
|
168
|
-
*/
|
|
169
|
-
staticDedupReused: number;
|
|
170
|
-
/** `HF_STATIC_DEDUP=true` was set for this render (adoption signal). */
|
|
171
|
-
staticDedupEnabled: boolean;
|
|
172
|
-
/** Dedup passed every gate + verification and was active. */
|
|
173
|
-
staticDedupArmed: boolean;
|
|
174
|
-
/** Predicted reusable frame count when armed; 0 otherwise. */
|
|
175
|
-
staticDedupPredicted: number;
|
|
176
|
-
/**
|
|
177
|
-
* Low-cardinality reason dedup did not arm: `capture_mode` | `video_injection`
|
|
178
|
-
* | `page_composite` | `ineligible` | `verification_failed` | `verification_budget`.
|
|
179
|
-
* Undefined when armed or when dedup was disabled. (Render-level aggregation may
|
|
180
|
-
* `|`-join distinct reasons when parallel workers diverge.)
|
|
181
|
-
*/
|
|
182
|
-
staticDedupSkipReason?: string;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// ── Global Augmentation ────────────────────────────────────────────────────────
|
|
186
|
-
|
|
187
|
-
declare global {
|
|
188
|
-
interface Window {
|
|
189
|
-
__hf?: HfProtocol;
|
|
190
|
-
}
|
|
191
|
-
}
|