@alpha2-sh/editor 0.4.6 → 0.5.0
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/dist/browser/bridge.d.ts +15 -16
- package/dist/browser/bridge.js +396 -312
- package/dist/browser/extensions-worker.d.ts +12 -16
- package/dist/browser/extensions-worker.js +17 -24
- package/dist/browser/hash-worker.d.ts +4 -5
- package/dist/browser/hash-worker.js +7 -8
- package/dist/browser/jobs.d.ts +17 -19
- package/dist/browser/jobs.js +41 -28
- package/dist/browser/resources.d.ts +6 -11
- package/dist/browser/resources.js +5 -9
- package/dist/browser/runtime/assets.d.ts +47 -28
- package/dist/browser/runtime/assets.js +129 -45
- package/dist/browser/runtime/audio.d.ts +16 -11
- package/dist/browser/runtime/audio.js +58 -31
- package/dist/browser/runtime/budget.d.ts +4 -5
- package/dist/browser/runtime/budget.js +4 -5
- package/dist/browser/runtime/caption-fonts.d.ts +3 -7
- package/dist/browser/runtime/caption-fonts.js +4 -8
- package/dist/browser/runtime/engine.d.ts +39 -44
- package/dist/browser/runtime/engine.js +78 -64
- package/dist/browser/runtime/export-audio.d.ts +6 -6
- package/dist/browser/runtime/export-audio.js +8 -9
- package/dist/browser/runtime/exporter.d.ts +33 -66
- package/dist/browser/runtime/exporter.js +111 -137
- package/dist/browser/runtime/extension-import.d.ts +28 -35
- package/dist/browser/runtime/extension-import.js +36 -46
- package/dist/browser/runtime/fingerprint.d.ts +11 -14
- package/dist/browser/runtime/fingerprint.js +20 -24
- package/dist/browser/runtime/generators.d.ts +2 -3
- package/dist/browser/runtime/generators.js +5 -7
- package/dist/browser/runtime/locks.d.ts +5 -7
- package/dist/browser/runtime/locks.js +5 -7
- package/dist/browser/runtime/output.d.ts +7 -9
- package/dist/browser/runtime/output.js +17 -21
- package/dist/browser/runtime/preview-utils.js +10 -6
- package/dist/browser/runtime/proxies.d.ts +10 -17
- package/dist/browser/runtime/proxies.js +33 -45
- package/dist/browser/runtime/proxy-storage.d.ts +15 -19
- package/dist/browser/runtime/proxy-storage.js +20 -24
- package/dist/browser/runtime/sources.d.ts +23 -31
- package/dist/browser/runtime/sources.js +85 -103
- package/dist/browser/runtime/staging.d.ts +2 -6
- package/dist/browser/runtime/staging.js +7 -11
- package/dist/browser/runtime/still.d.ts +2 -6
- package/dist/browser/runtime/still.js +6 -12
- package/dist/browser/runtime/text.d.ts +14 -0
- package/dist/browser/runtime/text.js +27 -0
- package/dist/browser/runtime/wasm.d.ts +4 -5
- package/dist/browser/runtime/wasm.js +4 -5
- package/dist/browser/types.d.ts +233 -238
- package/dist/browser/worker.d.ts +8 -9
- package/dist/browser/worker.js +50 -21
- package/dist/core/captions.d.ts +8 -10
- package/dist/core/captions.js +10 -18
- package/dist/core/clip-time.d.ts +8 -10
- package/dist/core/clip-time.js +12 -15
- package/dist/core/commands.d.ts +46 -46
- package/dist/core/commands.js +38 -36
- package/dist/core/compositions.d.ts +78 -112
- package/dist/core/compositions.js +66 -94
- package/dist/core/document.d.ts +59 -92
- package/dist/core/document.js +64 -90
- package/dist/core/keyframes.d.ts +11 -12
- package/dist/core/keyframes.js +11 -13
- package/dist/core/presets.d.ts +14 -20
- package/dist/core/presets.js +12 -18
- package/dist/core/session.d.ts +26 -38
- package/dist/core/session.js +38 -53
- package/dist/core/text.d.ts +2 -3
- package/dist/core/text.js +2 -3
- package/dist/core/timeline-index.d.ts +2 -3
- package/dist/core/timeline-index.js +11 -7
- package/dist/core/transitions.js +4 -5
- package/dist/core/validated.d.ts +6 -7
- package/dist/core/validated.js +8 -11
- package/dist/native-client/index.d.ts +31 -32
- package/dist/native-client/index.js +40 -41
- package/dist/ports/index.d.ts +19 -20
- package/dist/react/index.d.ts +5 -6
- package/dist/react/index.js +5 -6
- package/package.json +4 -4
package/dist/browser/types.d.ts
CHANGED
|
@@ -2,43 +2,35 @@ import type { Generator, MediaFingerprint, Project } from "alpha2/project";
|
|
|
2
2
|
import type { LayoutBounds } from "alpha2/layout";
|
|
3
3
|
import type { AssetBinding, ConformReport, MediaPurpose } from "alpha2/assets";
|
|
4
4
|
import type { BuiltinEffectCatalog, EffectDefinition } from "alpha2/effects";
|
|
5
|
+
import type { TrackDecodeFacts } from "alpha2/hdr-frames";
|
|
5
6
|
import type { EditorSession } from "../core/session.js";
|
|
6
7
|
import type { CapabilityReport, PlaybackPolicy } from "alpha2";
|
|
7
8
|
import type { Capability } from "../ports/index.js";
|
|
8
9
|
import type { Json } from "../core/document.js";
|
|
9
10
|
import type { ExportJob } from "./jobs.js";
|
|
10
|
-
/**
|
|
11
|
-
* Where a bundler put the runtime's code and data. Each URL defaults to the location the
|
|
12
|
-
* packaged module resolves on its own.
|
|
13
|
-
*/
|
|
11
|
+
/** Bundled locations of the runtime's code and data. Each URL defaults to the packaged one. */
|
|
14
12
|
export interface RuntimeAssets {
|
|
15
13
|
/**
|
|
16
|
-
* Creates a worker running `installEditorWorker`.
|
|
17
|
-
*
|
|
14
|
+
* Creates a worker running `installEditorWorker`. Without one the preview renders on the main
|
|
15
|
+
* thread.
|
|
18
16
|
*/
|
|
19
17
|
readonly workerFactory?: () => Worker;
|
|
20
18
|
/**
|
|
21
|
-
* Creates a worker running the `@alpha2-sh/editor/hash-worker` entry
|
|
22
|
-
*
|
|
23
|
-
* other tasks run every few milliseconds but spends the page's CPU (about 5 ms a megabyte).
|
|
19
|
+
* Creates a worker running the `@alpha2-sh/editor/hash-worker` entry for import hashing. Without
|
|
20
|
+
* one, files hash on the page's thread at about 5 ms per megabyte.
|
|
24
21
|
*/
|
|
25
22
|
readonly hashWorkerFactory?: () => Worker;
|
|
26
23
|
/**
|
|
27
|
-
* Creates a worker running the `@alpha2-sh/editor/extensions-worker` entry
|
|
28
|
-
* extension
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* those calls run on the page's thread, which waits for each: an animated image's open decodes
|
|
33
|
-
* every frame.
|
|
24
|
+
* Creates a worker running the `@alpha2-sh/editor/extensions-worker` entry, which probes, opens
|
|
25
|
+
* and thumbnails files read by extension providers (SVG, animated image, Lottie, OpenEXR). A
|
|
26
|
+
* cancelled import terminates it, as does a call past `EXTENSIONS_CALL_TIMEOUT_MS` (40 s, failing
|
|
27
|
+
* the import as `provider_stalled`). Without one, or if it cannot start, those calls block the
|
|
28
|
+
* page's thread.
|
|
34
29
|
*/
|
|
35
30
|
readonly extensionsWorkerFactory?: () => Worker;
|
|
36
31
|
/** The engine's wasm binary (`alpha2/wasm`). */
|
|
37
32
|
readonly wasmUrl?: string | URL;
|
|
38
|
-
/**
|
|
39
|
-
* Where a bundler put `alpha2_extensions_bg.wasm`, loaded when an SVG, animated image, or image
|
|
40
|
-
* sequence is opened.
|
|
41
|
-
*/
|
|
33
|
+
/** `alpha2_extensions_bg.wasm`, loaded when an SVG, animated image or image sequence opens. */
|
|
42
34
|
readonly extensionsWasmUrl?: string | URL;
|
|
43
35
|
/** The audio worklet's wasm binary, loaded on the first Play. */
|
|
44
36
|
readonly audioWasmUrl?: string | URL;
|
|
@@ -58,18 +50,15 @@ export interface RuntimeFont {
|
|
|
58
50
|
/** The face to read in a collection file (`.ttc`/`.otc`); 0 for a single-face file. */
|
|
59
51
|
readonly faceIndex: number;
|
|
60
52
|
}
|
|
61
|
-
/**
|
|
62
|
-
* A source's media as this browser session holds it. Never part of the project document or its
|
|
63
|
-
* history.
|
|
64
|
-
*/
|
|
53
|
+
/** A source's media as this browser session holds it; never part of the document or its history. */
|
|
65
54
|
export interface RuntimeAsset {
|
|
66
55
|
readonly id: string;
|
|
67
56
|
/** `video`, `image`, `audio`, `text`, `font`, `lut3d`, or `generated`. */
|
|
68
57
|
readonly kind: string;
|
|
69
58
|
readonly name?: string;
|
|
70
59
|
/**
|
|
71
|
-
* What the source is read from. A still is decoded from it each
|
|
72
|
-
*
|
|
60
|
+
* What the source is read from. A still is decoded from it on each raster cache miss; no decoded
|
|
61
|
+
* picture is kept with the asset.
|
|
73
62
|
*/
|
|
74
63
|
readonly file?: File;
|
|
75
64
|
/** Small preview canvas; `dataUrl` is a ready-to-use image URL. */
|
|
@@ -83,17 +72,22 @@ export interface RuntimeAsset {
|
|
|
83
72
|
readonly height?: number;
|
|
84
73
|
/** Seconds; 0 for a still. */
|
|
85
74
|
readonly duration?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Whether the file has an audio stream: what the document records as the source's `has_audio`,
|
|
88
|
-
* whichever browser imported it.
|
|
89
|
-
*/
|
|
75
|
+
/** Whether the file has an audio stream, as the document records in `has_audio`. */
|
|
90
76
|
readonly hasAudio?: boolean;
|
|
91
77
|
/**
|
|
92
78
|
* `false` when this browser cannot decode the file's audio (Safari before 26 has no
|
|
93
|
-
* `AudioDecoder`)
|
|
94
|
-
*
|
|
79
|
+
* `AudioDecoder`). It then plays and exports silent in this session, while the document still
|
|
80
|
+
* records the audio for native hosts and other browsers.
|
|
95
81
|
*/
|
|
96
82
|
readonly audioDecodable?: boolean;
|
|
83
|
+
/** When `audioDecodable` is `false`, what the trial decode at import found. */
|
|
84
|
+
readonly audioDecodeFacts?: TrackDecodeFacts;
|
|
85
|
+
/**
|
|
86
|
+
* For a video, `unavailable` when this browser decodes it only to frames the engine cannot read
|
|
87
|
+
* (HDR, see `BrowserBridgeOptions.hdrWithoutPlanes`). It then previews degraded and cannot export
|
|
88
|
+
* in this session.
|
|
89
|
+
*/
|
|
90
|
+
readonly planarDecode?: "available" | "unavailable";
|
|
97
91
|
/** Per-bucket peak magnitudes across the whole file, for audio sources. */
|
|
98
92
|
readonly peaks?: Float32Array | null;
|
|
99
93
|
/** `native`: drawn centred at its own pixel size (text); otherwise contained. */
|
|
@@ -112,21 +106,16 @@ export interface StagedAsset {
|
|
|
112
106
|
/** Decodes and probes files for import. `createMediaAdapter` makes the default one. */
|
|
113
107
|
export interface BrowserMediaAdapter {
|
|
114
108
|
/**
|
|
115
|
-
* Stages one file. The bridge
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* `
|
|
122
|
-
* `provider_stalled` for one the extensions worker read past `EXTENSIONS_CALL_TIMEOUT_MS`, and
|
|
123
|
-
* when `signal` aborts.
|
|
109
|
+
* Stages one file. The bridge stages at most four files of one import at once.
|
|
110
|
+
*
|
|
111
|
+
* Rejects with an `EditorError` coded `unsupported_media` for a file the adapter does not import,
|
|
112
|
+
* `unreadable_media` when this browser or an extension provider cannot read it (the reason is the
|
|
113
|
+
* message and `cause`), `too_large` for Lottie, dotLottie or SVG past the engine's parse limits
|
|
114
|
+
* (`MAX_LOTTIE_DOCUMENT_BYTES`, `MAX_PROVIDER_DOCUMENT_BYTES`, `MAX_SVG_DOCUMENT_BYTES`),
|
|
115
|
+
* `provider_stalled` past `EXTENSIONS_CALL_TIMEOUT_MS`, and when `signal` aborts.
|
|
124
116
|
*/
|
|
125
117
|
stage(file: File, signal: AbortSignal, options?: {
|
|
126
|
-
/**
|
|
127
|
-
* `false` when the caller has no use for the file's fingerprint and it need not be computed:
|
|
128
|
-
* the bridge adopts a kept proxy by its original's hash. Default `true`.
|
|
129
|
-
*/
|
|
118
|
+
/** Pass `false` to skip computing the fingerprint. Default `true`. */
|
|
130
119
|
readonly fingerprint?: boolean;
|
|
131
120
|
}): Promise<StagedAsset>;
|
|
132
121
|
/** Stages numbered PNGs or OpenEXR images as one image sequence. */
|
|
@@ -136,28 +125,20 @@ export interface BrowserMediaAdapter {
|
|
|
136
125
|
readonly den: number;
|
|
137
126
|
};
|
|
138
127
|
readonly missing: "reject" | "hold" | "blank";
|
|
139
|
-
/**
|
|
140
|
-
* The source ID the frames are staged under: the asset's own for a relink, a new one
|
|
141
|
-
* otherwise.
|
|
142
|
-
*/
|
|
128
|
+
/** Source ID to stage the frames under: the asset's own for a relink, else a new one. */
|
|
143
129
|
readonly id?: string;
|
|
144
130
|
}, signal: AbortSignal): Promise<StagedAsset & {
|
|
145
131
|
readonly name?: string;
|
|
146
132
|
}>;
|
|
147
133
|
}
|
|
148
|
-
/**
|
|
149
|
-
* What `installEditorWorker` uses of a dedicated worker's global (`self` in the worker): its
|
|
150
|
-
* message handler and `postMessage`.
|
|
151
|
-
*/
|
|
134
|
+
/** The parts of a dedicated worker's global (`self`) that `installEditorWorker` uses. */
|
|
152
135
|
export interface EditorWorkerScope {
|
|
153
136
|
onmessage: ((event: MessageEvent) => void) | null;
|
|
154
137
|
postMessage(message: unknown, transfer?: Transferable[]): void;
|
|
155
138
|
}
|
|
156
139
|
/** Options of `createBrowserBridge`. */
|
|
157
140
|
export interface BrowserBridgeOptions {
|
|
158
|
-
/**
|
|
159
|
-
* The session the bridge previews, imports into, and exports. Disposing it disposes the bridge.
|
|
160
|
-
*/
|
|
141
|
+
/** Session the bridge previews, imports into and exports. Disposing it disposes the bridge. */
|
|
161
142
|
readonly editor: EditorSession;
|
|
162
143
|
readonly runtimeAssets?: RuntimeAssets;
|
|
163
144
|
/** Defaults to `createMediaAdapter(runtimeAssets)`. */
|
|
@@ -167,14 +148,11 @@ export interface BrowserBridgeOptions {
|
|
|
167
148
|
* default 128. An import past it is refused with `EditorError` `resource_budget`.
|
|
168
149
|
*/
|
|
169
150
|
readonly resourceLimit?: number;
|
|
170
|
-
/**
|
|
171
|
-
* `false` renders picture only: no AudioContext is opened and playback runs on the wall clock
|
|
172
|
-
* (thumbnails and other silent previews).
|
|
173
|
-
*/
|
|
151
|
+
/** `false` renders picture only: no AudioContext opens and playback runs on the wall clock. */
|
|
174
152
|
readonly audio?: boolean;
|
|
175
153
|
/**
|
|
176
|
-
* Receives errors no caller awaits
|
|
177
|
-
*
|
|
154
|
+
* Receives errors no caller awaits, such as a failed preview render or audio that did not start.
|
|
155
|
+
* The bridge keeps running after each.
|
|
178
156
|
*/
|
|
179
157
|
readonly onError?: (error: unknown) => void;
|
|
180
158
|
/**
|
|
@@ -183,67 +161,75 @@ export interface BrowserBridgeOptions {
|
|
|
183
161
|
*/
|
|
184
162
|
readonly assetDecisions?: AssetBinding;
|
|
185
163
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* document's resolution, and text and effects match export pixel for pixel. See
|
|
189
|
-
* `BrowserBridge.setPreviewScale`.
|
|
164
|
+
* Preview resolution scale relative to the document's size, above 0 and at most 8, default 0.5.
|
|
165
|
+
* At 1, text and effects match export pixel for pixel. See `BrowserBridge.setPreviewScale`.
|
|
190
166
|
*/
|
|
191
167
|
readonly previewScale?: number;
|
|
192
168
|
/**
|
|
193
|
-
* Who converts decoded SDR video frames to the engine's pixels, in
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* export's. HDR frames, and frames of a source whose color the project declares, are the
|
|
201
|
-
* engine's either way. Another value is refused when the bridge is made, with an `EditorError`
|
|
169
|
+
* Who converts decoded SDR video frames to the engine's pixels, in preview and export (an export
|
|
170
|
+
* may override it with `BrowserExportOptions.videoConversion`). `engine` (the default) copies the
|
|
171
|
+
* planes out and converts them with the engine's shader, as a native export does. `browser`
|
|
172
|
+
* saves that copy (1 to 4 ms per frame per video layer) but ignores the stream's chroma siting,
|
|
173
|
+
* so sharp chroma edges can differ from a native export (Chrome places H.264 and HEVC chroma half
|
|
174
|
+
* a sample off). HDR frames and sources whose color the project declares always use the engine.
|
|
175
|
+
* Another value is refused when the bridge is made, with an `EditorError`
|
|
202
176
|
* `invalid_video_conversion`.
|
|
203
177
|
*/
|
|
204
178
|
readonly videoConversion?: "engine" | "browser";
|
|
179
|
+
/**
|
|
180
|
+
* `"auto"` (the default) draws with a hardware GPU through WebGPU or WebGL2, else with the
|
|
181
|
+
* engine's CPU renderer (also when only a software adapter exists). `"gpu"` accepts any adapter,
|
|
182
|
+
* software included. `"cpu"` uses the CPU renderer, which runs no runtime effects. GPU-loss
|
|
183
|
+
* recovery may still move the preview, or an export retry, to the CPU. `capabilities.renderer`
|
|
184
|
+
* reports the preview's. Another value is refused when the bridge is made, with a `RangeError`.
|
|
185
|
+
*/
|
|
186
|
+
readonly renderer?: "auto" | "gpu" | "cpu";
|
|
187
|
+
/**
|
|
188
|
+
* Handling of HDR video this browser decodes only to frames the engine cannot read and has no
|
|
189
|
+
* software decoder for (10-bit HEVC HDR in Chrome). `preview-degraded` (the default) imports it,
|
|
190
|
+
* previews it through the browser's tone mapping with `previewIssue` set, and makes `startExport`
|
|
191
|
+
* refuse exports that show it (`unsupported_media`, its cause a `PlanarDecodeUnavailableError`).
|
|
192
|
+
* The native host (`@alpha2-sh/editor/native-client`) can export such a project. `refuse`
|
|
193
|
+
* refuses the import (`unsupported_media`). Another value is refused when the bridge is made
|
|
194
|
+
* (`RangeError`).
|
|
195
|
+
*/
|
|
196
|
+
readonly hdrWithoutPlanes?: "refuse" | "preview-degraded";
|
|
205
197
|
}
|
|
206
198
|
/** Options of `BrowserBridge.startExport`. */
|
|
207
199
|
export interface BrowserExportOptions {
|
|
208
200
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* `INVALID_INPUT`.
|
|
201
|
+
* File format, default `mp4`. It limits the codecs (see `alpha2/containers`): `mov` takes no
|
|
202
|
+
* VP9, AV1 or Opus, and `webm` takes only VP9, AV1 and Opus. Other codecs are refused before the
|
|
203
|
+
* export renders, as `INVALID_INPUT`.
|
|
213
204
|
*/
|
|
214
205
|
readonly container?: "mp4" | "mov" | "mkv" | "webm";
|
|
215
206
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* refused before it renders, as `INVALID_INPUT`.
|
|
207
|
+
* Defaults to the container's (`avc`, or `vp9` for `webm`). A codec this browser does not encode
|
|
208
|
+
* ({@link BrowserBridge.videoEncoders}) is refused before the export renders, as `INVALID_INPUT`.
|
|
219
209
|
*/
|
|
220
210
|
readonly videoCodec?: "avc" | "hevc" | "vp9" | "av1";
|
|
221
211
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
212
|
+
* Defaults to the first of the container's audio codecs this browser encodes (AAC then Opus for
|
|
213
|
+
* `mp4` and `mkv`, AAC for `mov`, Opus for `webm`). A codec this browser cannot encode is refused
|
|
214
|
+
* before the export renders, as `INVALID_INPUT`.
|
|
225
215
|
*/
|
|
226
216
|
readonly audioCodec?: "aac" | "opus";
|
|
227
217
|
/**
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* as it does for a native export.
|
|
218
|
+
* Engine quality level (`very-low`, `low`, `medium`, `high`, `very-high`), default `high`. The
|
|
219
|
+
* engine resolves it to a bitrate for the codec, size and frame rate, as for a native export.
|
|
231
220
|
*/
|
|
232
221
|
readonly videoQuality?: string;
|
|
233
222
|
/** An engine quality level for the audio, default `high`. */
|
|
234
223
|
readonly audioQuality?: string;
|
|
235
224
|
/**
|
|
236
|
-
* Default `true`. Audio is written only when an audible source is shown. An export with
|
|
237
|
-
*
|
|
238
|
-
* codecs.
|
|
225
|
+
* Default `true`. Audio is written only when an audible source is shown. An export with audio is
|
|
226
|
+
* refused before it renders if this browser encodes none of the container's audio codecs.
|
|
239
227
|
*/
|
|
240
228
|
readonly includeAudio?: boolean;
|
|
241
229
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* frame at least one tick long) is refused when the export starts, with an `EditorError`
|
|
246
|
-
* `invalid_frame_rate`.
|
|
230
|
+
* Exact export frame rate as `num / den` (`{ num: 30000, den: 1001 }` for 29.97), instead of the
|
|
231
|
+
* project's. `num` and `den` must be positive 32-bit integers giving a frame at least one tick
|
|
232
|
+
* long, else the export is refused when it starts with an `EditorError` `invalid_frame_rate`.
|
|
247
233
|
*/
|
|
248
234
|
readonly frameRate?: {
|
|
249
235
|
readonly num: number;
|
|
@@ -255,40 +241,35 @@ export interface BrowserExportOptions {
|
|
|
255
241
|
*/
|
|
256
242
|
readonly media?: "original" | "proxies";
|
|
257
243
|
/**
|
|
258
|
-
* Where the file is written. `opfs` (the default where
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* never to an unbounded buffer.
|
|
244
|
+
* Where the file is written. `opfs` (the default where supported) streams to a temporary
|
|
245
|
+
* origin-private file that the job's artifact holds until released. `file` streams to a file the
|
|
246
|
+
* user picked (`showSaveFilePicker`, obtained during the click that started the export). `memory`
|
|
247
|
+
* is for small outputs: the export is refused before it starts when its estimated size, with
|
|
248
|
+
* room for buffer growth and copies, passes `maxBytes` (default 512 MiB). Without a disk API the
|
|
249
|
+
* export falls back to `memory` under the same limit.
|
|
265
250
|
*/
|
|
266
251
|
readonly output?: ExportOutputTarget;
|
|
267
252
|
/**
|
|
268
|
-
* `inFlightBytes` bounds the rendered frames
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* the budget, the least one frame needed, the most held, and how often the budget waited.
|
|
253
|
+
* `inFlightBytes` bounds the rendered frames held at once (GPU readbacks and copies queued for
|
|
254
|
+
* the encoder), default 128 MiB. The export is refused before it starts when one frame's readback
|
|
255
|
+
* and copy cannot fit. The result's `performance.memory` reports the budget, the least one frame
|
|
256
|
+
* needed, the most held, and how often the budget waited.
|
|
273
257
|
*/
|
|
274
258
|
readonly memory?: {
|
|
275
259
|
readonly inFlightBytes?: number;
|
|
276
260
|
};
|
|
277
261
|
/**
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* software. Another value is refused when the export starts, with an `EditorError`
|
|
284
|
-
* `invalid_video_decode`.
|
|
262
|
+
* `auto` (the default) lets the browser pick, a hardware decoder where it has one. `software`
|
|
263
|
+
* decodes on the CPU so no frame is read back from the GPU; a source the browser has no software
|
|
264
|
+
* decoder for decodes as `auto` and is listed in the result's `report.decodeFallbacks`
|
|
265
|
+
* (`kind: "software-unavailable"`). Another value is refused when the export starts, with an
|
|
266
|
+
* `EditorError` `invalid_video_decode`.
|
|
285
267
|
*/
|
|
286
268
|
readonly videoDecode?: "auto" | "software";
|
|
287
269
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* `invalid_video_conversion`.
|
|
270
|
+
* Overrides `BrowserBridgeOptions.videoConversion` for this export; the result's
|
|
271
|
+
* `report.videoConversion` says which ran. Another value is refused when the export starts, with
|
|
272
|
+
* an `EditorError` `invalid_video_conversion`.
|
|
292
273
|
*/
|
|
293
274
|
readonly videoConversion?: "engine" | "browser";
|
|
294
275
|
}
|
|
@@ -321,11 +302,6 @@ export interface ProxyRemoval {
|
|
|
321
302
|
readonly removed: readonly string[];
|
|
322
303
|
readonly inUse: readonly string[];
|
|
323
304
|
}
|
|
324
|
-
/**
|
|
325
|
-
* The browser runtime of one editor session, made by `createBrowserBridge`. Times are integer
|
|
326
|
-
* ticks (120000 per second). Methods that change the document dispatch through the session, so
|
|
327
|
-
* they are undoable.
|
|
328
|
-
*/
|
|
329
305
|
/** A rectangle in fractions of the canvas, y down, as a text style's `position` is. */
|
|
330
306
|
export interface CanvasRect {
|
|
331
307
|
readonly left: number;
|
|
@@ -334,83 +310,106 @@ export interface CanvasRect {
|
|
|
334
310
|
readonly bottom: number;
|
|
335
311
|
}
|
|
336
312
|
/**
|
|
337
|
-
* Where a text generator's text lies on
|
|
338
|
-
*
|
|
313
|
+
* Where a text generator's text lies on its picture, before the clip's transform and effects.
|
|
314
|
+
* Returned by {@link BrowserBridge.measureText}.
|
|
339
315
|
*/
|
|
340
316
|
export interface TextBounds {
|
|
341
317
|
/**
|
|
342
318
|
* The box the style's `anchor` and `position` place: `max_width` wide, every line's em box tall,
|
|
343
|
-
*
|
|
319
|
+
* plus outline and background padding.
|
|
344
320
|
*/
|
|
345
321
|
readonly layout: CanvasRect;
|
|
346
322
|
/**
|
|
347
|
-
* From the start
|
|
348
|
-
*
|
|
349
|
-
* advances do, not as glyphs with more or less ink are typed: steady handles for a text clip.
|
|
323
|
+
* From the leftmost line start to the rightmost line end, as tall as `layout`, with the same
|
|
324
|
+
* padding. It moves only when line advances change, not glyph ink, so it gives steady handles.
|
|
350
325
|
*/
|
|
351
326
|
readonly content: CanvasRect;
|
|
352
327
|
/**
|
|
353
|
-
* What the text draws
|
|
354
|
-
*
|
|
355
|
-
* `null` when the text draws nothing (only spaces).
|
|
328
|
+
* What the text draws (glyphs, outline, background boxes), within about a pixel of sampling
|
|
329
|
+
* spread. `null` when the text draws nothing (only spaces).
|
|
356
330
|
*/
|
|
357
331
|
readonly ink: CanvasRect | null;
|
|
358
332
|
readonly lineCount: number;
|
|
359
333
|
}
|
|
334
|
+
/** The renderer that draws the bound preview, in {@link BrowserBridge.capabilities}. */
|
|
335
|
+
export interface PreviewRenderer {
|
|
336
|
+
/** `"gpu"`, or `"cpu"`: the engine's CPU renderer in wasm. */
|
|
337
|
+
readonly renderer: "gpu" | "cpu";
|
|
338
|
+
/**
|
|
339
|
+
* Why it draws on the CPU: no hardware GPU (a refused software adapter is named), or a GPU loss
|
|
340
|
+
* moved the preview there. `null` on a GPU.
|
|
341
|
+
*/
|
|
342
|
+
readonly rendererReason: string | null;
|
|
343
|
+
readonly backend: "webgpu" | "webgl2" | "cpu" | null;
|
|
344
|
+
/** The GPU adapter as the browser names it; `null` on the CPU or when it names none. */
|
|
345
|
+
readonly adapter: string | null;
|
|
346
|
+
/** Whether runtime effects draw. The CPU renderer refuses them, reporting each once. */
|
|
347
|
+
readonly runtimeEffects: boolean;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* The browser runtime of one editor session, made by `createBrowserBridge`. Times are integer
|
|
351
|
+
* ticks (120000 per second). Methods that change the document dispatch through the session, so
|
|
352
|
+
* they are undoable.
|
|
353
|
+
*/
|
|
360
354
|
export interface BrowserBridge {
|
|
361
355
|
/** Where the preview renders: nowhere until `bindPreview`, then a worker or the main thread. */
|
|
362
356
|
readonly previewBackend: "unbound" | "worker" | "main-thread";
|
|
363
357
|
/** How many times the preview was made again after its GPU device or WebGL context was lost. */
|
|
364
358
|
readonly previewRecoveries: number;
|
|
365
|
-
/**
|
|
359
|
+
/**
|
|
360
|
+
* What this page can do; `gpu`, `color` and `renderer` are `null` until a preview is bound.
|
|
361
|
+
* `features.preview` and `features.export` need no GPU: without one the engine draws on the CPU.
|
|
362
|
+
*/
|
|
366
363
|
readonly capabilities: CapabilityReport<null, null> & {
|
|
364
|
+
readonly renderer: PreviewRenderer | null;
|
|
367
365
|
readonly features: Readonly<Record<"preview" | "audioPreview" | "transportRate" | "worker" | "export", Capability>>;
|
|
368
366
|
};
|
|
369
|
-
/** The playhead. */
|
|
367
|
+
/** The playhead, in ticks. */
|
|
370
368
|
readonly tick: number;
|
|
371
369
|
readonly playing: boolean;
|
|
372
370
|
/** Runtime resources currently held (see `BrowserBridgeOptions.resourceLimit`). */
|
|
373
371
|
readonly resourceCount: number;
|
|
374
372
|
/**
|
|
375
|
-
* Preview output volume from 0 to 1
|
|
376
|
-
*
|
|
377
|
-
* preview's sound. Throws for a value outside that range.
|
|
373
|
+
* Preview output volume from 0 to 1, a monitor control outside the project and exports. Kept by
|
|
374
|
+
* the bridge across bindings. Throws for a value outside that range.
|
|
378
375
|
*/
|
|
379
376
|
setMonitorVolume(value: number): void;
|
|
380
377
|
/** The monitor volume `setMonitorVolume` last set; 1 until then. */
|
|
381
378
|
readonly monitorVolume: number;
|
|
382
379
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
380
|
+
* Shifts the preview picture against its sound by `ms` milliseconds (positive shows it later),
|
|
381
|
+
* for output delay the browser does not report, such as a wireless headset's. Kept across
|
|
382
|
+
* bindings. Throws for a value that is not finite or beyond 2000 ms either way.
|
|
385
383
|
*/
|
|
384
|
+
setAudioOffset(ms: number): void;
|
|
385
|
+
/** The offset `setAudioOffset` last set; 0 until then. */
|
|
386
|
+
readonly audioOffsetMs: number;
|
|
387
|
+
/** Logs every source upload of the preview renderer to the console. Kept across bindings. */
|
|
386
388
|
setTraceUploads(value: boolean): void;
|
|
387
389
|
/**
|
|
388
|
-
* Turns per-pass GPU and CPU timing of the renderer
|
|
389
|
-
* passes then appear in `diagnostics`.
|
|
390
|
-
* later bindings.
|
|
390
|
+
* Turns per-pass GPU and CPU timing of the preview renderer on or off (off by default); the
|
|
391
|
+
* passes then appear in `diagnostics`. Kept across bindings.
|
|
391
392
|
*/
|
|
392
393
|
setPassTiming(enabled: boolean): void;
|
|
393
394
|
/** The preview resolution scale (see `BrowserBridgeOptions.previewScale`). */
|
|
394
395
|
readonly previewScale: number;
|
|
395
396
|
/**
|
|
396
|
-
* Renders the preview at `scale` times the document's size
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
* most 8.
|
|
397
|
+
* Renders the preview at `scale` times the document's size and redraws the current frame;
|
|
398
|
+
* resolves once drawn. The bound canvas's backing store takes the render size, so size the canvas
|
|
399
|
+
* on the page with CSS (as `EditorPreview` does). Rejects with `invalid_preview_scale` unless the
|
|
400
|
+
* scale is above 0 and at most 8.
|
|
401
401
|
*/
|
|
402
402
|
setPreviewScale(scale: number): Promise<void>;
|
|
403
403
|
/**
|
|
404
|
-
* The latest diagnostics sample of the renderer
|
|
405
|
-
*
|
|
406
|
-
* timing:
|
|
404
|
+
* The latest diagnostics sample of the preview renderer (taken at most every 250 ms), or `null`.
|
|
405
|
+
* Its `host` block adds to the renderer's timing:
|
|
407
406
|
* - `renders`: frames the player drew;
|
|
408
|
-
* - `unchanged`: frames
|
|
409
|
-
* - `skippedRequests`: playback refreshes that
|
|
410
|
-
* frame the clock asked for;
|
|
407
|
+
* - `unchanged`: frames equal to the one shown, so neither drawn nor presented;
|
|
408
|
+
* - `skippedRequests`: playback refreshes that needed no new frame;
|
|
411
409
|
* - `bitmapTransfers`: frames copied to the bound canvas from another surface;
|
|
412
410
|
* - `renderSize`: `[width, height]` frames render at;
|
|
413
|
-
* - `previewScale`, and `backend` (`worker` or `main-thread`)
|
|
411
|
+
* - `previewScale`, and `backend` (`worker` or `main-thread`);
|
|
412
|
+
* - `audioLatencySource`: `output-latency`, `output-timestamp`, `base-only`, or `null` if silent.
|
|
414
413
|
* Counters are cumulative (`renders` and `unchanged` per renderer, the others since
|
|
415
414
|
* `bindPreview`): subtract two samples for a rate.
|
|
416
415
|
*/
|
|
@@ -418,52 +417,46 @@ export interface BrowserBridge {
|
|
|
418
417
|
/** The engine's built-in effects and transitions; `null` until a preview is bound. */
|
|
419
418
|
readonly catalog: BuiltinEffectCatalog | null;
|
|
420
419
|
/**
|
|
421
|
-
* Adds runtime effects
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
420
|
+
* Adds runtime effects and transitions beyond the built-in catalog, addressable by `id@version`.
|
|
421
|
+
* They belong to the bridge, not the document: every renderer the bridge makes registers them
|
|
422
|
+
* (preview, a preview remade after GPU loss, each export attempt), and loading another project
|
|
423
|
+
* keeps them.
|
|
425
424
|
*
|
|
426
|
-
* With a preview bound, the definitions
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* registers those kept when it starts, and an export attempt the engine refuses one in fails with
|
|
425
|
+
* With a preview bound, the definitions compile on its device all or none, and the call rejects
|
|
426
|
+
* with `invalid_effect` naming the first one the engine refuses. Without one they are kept
|
|
427
|
+
* unchecked; `bindPreview` compiles them and drops any refused one, reporting it to `onError` as
|
|
428
|
+
* `invalid_effect`. An export attempt in which the engine refuses one fails with
|
|
431
429
|
* `invalid_effect`.
|
|
432
430
|
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
* bridge is disposed
|
|
431
|
+
* Registering the same definition under an `id@version` again is skipped; a different one is
|
|
432
|
+
* refused with `effect_conflict` (change the version instead). Also rejects with `invalid_effect`
|
|
433
|
+
* for a definition without a string `id` and an integer `version`, and with `disposed` after the
|
|
434
|
+
* bridge is disposed.
|
|
437
435
|
*/
|
|
438
436
|
registerEffects(definitions: readonly EffectDefinition[]): Promise<void>;
|
|
439
437
|
/**
|
|
440
|
-
* Source `id` of the draft: its original while
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
* whether the original itself is linked.
|
|
438
|
+
* Source `id` of the draft: its original while online, even where preview reads a proxy (see
|
|
439
|
+
* {@link BrowserBridge.setPreviewMedia}), else the kept proxy standing in for it. Use
|
|
440
|
+
* {@link BrowserBridge.hasOriginal} to ask whether the original itself is linked.
|
|
444
441
|
*/
|
|
445
442
|
getAsset(id: string): RuntimeAsset | null;
|
|
446
|
-
/**
|
|
447
|
-
* Notifies when derived runtime data (such as waveform peaks) becomes available for an already
|
|
448
|
-
* imported asset.
|
|
449
|
-
*/
|
|
443
|
+
/** Notifies when derived runtime data (such as waveform peaks) arrives for an imported asset. */
|
|
450
444
|
subscribeAssets(listener: () => void): () => void;
|
|
451
445
|
/**
|
|
452
|
-
* Why the viewer holds its last frame
|
|
453
|
-
*
|
|
446
|
+
* Why the viewer holds its last frame, or `null` when it is current (a composition at the
|
|
447
|
+
* playhead cannot draw its output yet). Also set while an HDR source shows through the browser's
|
|
448
|
+
* own tone mapping (see `BrowserBridgeOptions.hdrWithoutPlanes`), which cannot export here.
|
|
454
449
|
*/
|
|
455
450
|
readonly previewIssue: string | null;
|
|
456
451
|
/** Notifies when {@link previewIssue} changes. */
|
|
457
452
|
subscribePreview(listener: () => void): () => void;
|
|
458
453
|
/**
|
|
459
454
|
* Draws the preview on `canvas`. Rejects only when the surface cannot be bound (the GPU would not
|
|
460
|
-
* start); a first frame that cannot render, such as one
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
* report, as a lost GPU on the main thread is). A given-up worker is not started again until the
|
|
466
|
-
* next `bindPreview`, not even by a preview made again after a lost GPU.
|
|
455
|
+
* start); a first frame that cannot render, such as one with unlinked media, goes to `onError`
|
|
456
|
+
* and is drawn by the next edit or seek. If the preview worker fails, the main-thread renderer
|
|
457
|
+
* takes over the same surface: `previewBackend` becomes `main-thread` and `onError` receives one
|
|
458
|
+
* `EditorError` `preview_worker_failed` (a worker that loses its GPU recovers without a report).
|
|
459
|
+
* The worker is not restarted until the next `bindPreview`.
|
|
467
460
|
*/
|
|
468
461
|
bindPreview(canvas: HTMLCanvasElement | OffscreenCanvas): Promise<{
|
|
469
462
|
readonly canvas: HTMLCanvasElement | OffscreenCanvas;
|
|
@@ -505,9 +498,9 @@ export interface BrowserBridge {
|
|
|
505
498
|
assetIds: string[];
|
|
506
499
|
}>;
|
|
507
500
|
/**
|
|
508
|
-
* Relinks an image sequence to its frames
|
|
509
|
-
*
|
|
510
|
-
*
|
|
501
|
+
* Relinks an image sequence to its frames at the recorded frame rate and gap rule, keeping its ID
|
|
502
|
+
* and clips; the engine decides whether the frames match the recorded sequence. Refused for an
|
|
503
|
+
* asset that is not an image sequence.
|
|
511
504
|
*/
|
|
512
505
|
relinkSequence(id: string, files: readonly File[], options?: {
|
|
513
506
|
signal?: AbortSignal;
|
|
@@ -535,43 +528,43 @@ export interface BrowserBridge {
|
|
|
535
528
|
/** Stops playback and audio; the playhead stays where it was. */
|
|
536
529
|
pause(): void;
|
|
537
530
|
/**
|
|
538
|
-
* Reads a subtitle file (`.srt`, or `.vtt` for WebVTT) into a captions asset in the bin
|
|
539
|
-
*
|
|
540
|
-
*
|
|
531
|
+
* Reads a subtitle file (`.srt`, or `.vtt` for WebVTT) into a captions asset in the bin;
|
|
532
|
+
* `skipped` counts blocks that were not cues. Nothing reaches the timeline until the asset is
|
|
533
|
+
* inserted (`captionTrackCommands`).
|
|
541
534
|
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
* `MAX_CAPTION_FILE_CUES` cues, or cues that need more caption tracks than a project holds
|
|
535
|
+
* Rejects with an `EditorError` `invalid_captions` for a file larger than
|
|
536
|
+
* `MAX_CAPTION_FILE_BYTES` (not read), a WebVTT file without its header, more than
|
|
537
|
+
* `MAX_CAPTION_FILE_CUES` cues, or cues that need more caption tracks than a project holds, and
|
|
538
|
+
* with `invalid_text` for a file that is neither UTF-8 nor UTF-16 with a byte order mark.
|
|
545
539
|
*/
|
|
546
540
|
importCaptions(file: File): Promise<{
|
|
547
541
|
assetId: string;
|
|
548
542
|
skipped: number;
|
|
549
543
|
}>;
|
|
550
544
|
/**
|
|
551
|
-
* The font families caption styles can name in `font_family`:
|
|
552
|
-
*
|
|
553
|
-
* name tables.
|
|
545
|
+
* The font families caption styles can name in `font_family`: the document's font assets and
|
|
546
|
+
* the runtime's fonts, in fallback order, deduplicated, as read from the fonts' name tables.
|
|
554
547
|
*/
|
|
555
548
|
captionFontFamilies(): Promise<string[]>;
|
|
556
549
|
/**
|
|
557
|
-
* Where the engine draws a text generator's text (see {@link TextBounds})
|
|
558
|
-
*
|
|
559
|
-
*
|
|
550
|
+
* Where the engine draws a text generator's text (see {@link TextBounds}), laid out as preview
|
|
551
|
+
* does at the draft's canvas size, without rendering. The clip's transform maps these rectangles
|
|
552
|
+
* like the rest of its picture.
|
|
560
553
|
*
|
|
561
|
-
* Rejects
|
|
562
|
-
*
|
|
554
|
+
* Rejects an invalid text generator (`INVALID_INPUT`), one with no fonts to draw it, and after
|
|
555
|
+
* the bridge is disposed (`disposed`).
|
|
563
556
|
*/
|
|
564
557
|
measureText(generator: Extract<Generator, {
|
|
565
558
|
type: "text";
|
|
566
559
|
}>): Promise<TextBounds>;
|
|
567
560
|
/**
|
|
568
561
|
* Where every box of a layout generator lies at picture time `time` (whole ticks) and whether
|
|
569
|
-
* anything overflows (see `alpha2/layout`'s `LayoutBounds`)
|
|
570
|
-
*
|
|
571
|
-
*
|
|
562
|
+
* anything overflows (see `alpha2/layout`'s `LayoutBounds`), laid out as preview does at the
|
|
563
|
+
* draft's canvas size, without rendering. The clip's transform maps these rectangles like the
|
|
564
|
+
* rest of its picture.
|
|
572
565
|
*
|
|
573
|
-
* Rejects
|
|
574
|
-
*
|
|
566
|
+
* Rejects an invalid layout generator (`INVALID_INPUT`), a layout with text and no fonts to draw
|
|
567
|
+
* it, and after the bridge is disposed (`disposed`).
|
|
575
568
|
*/
|
|
576
569
|
measureLayout(generator: Extract<Generator, {
|
|
577
570
|
type: "layout";
|
|
@@ -589,13 +582,12 @@ export interface BrowserBridge {
|
|
|
589
582
|
*/
|
|
590
583
|
conform(purpose: MediaPurpose, document?: import("../core/document.js").EditorDocument): Promise<ConformReport>;
|
|
591
584
|
/**
|
|
592
|
-
* Makes and keeps a proxy of a source whose original this session holds. Proxies are made one
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
* (`proxy_busy`), or when `signal` aborts.
|
|
585
|
+
* Makes and keeps a proxy of a source whose original this session holds. Proxies are made one at
|
|
586
|
+
* a time and never during an export: this waits for a running export or another proxy, and an
|
|
587
|
+
* export that starts restarts the conversion from 0 once it ends. Rejects for a source without a
|
|
588
|
+
* single video file (`unsupported_media`, including HDR video), without its original in this
|
|
589
|
+
* session (`missing_asset`), with a proxy already being made (`proxy_busy`), or when `signal`
|
|
590
|
+
* aborts.
|
|
599
591
|
*/
|
|
600
592
|
generateProxy(id: string, options?: {
|
|
601
593
|
signal?: AbortSignal;
|
|
@@ -604,22 +596,18 @@ export interface BrowserBridge {
|
|
|
604
596
|
proxyStatus(id: string): ProxyStatus;
|
|
605
597
|
/**
|
|
606
598
|
* Which video codecs this browser encodes for an export of the current document (its size and
|
|
607
|
-
* frame rate) at `videoQuality` (default `high`).
|
|
608
|
-
*
|
|
599
|
+
* frame rate) at `videoQuality` (default `high`). An export with a codec answered `false` is
|
|
600
|
+
* refused before it renders (`INVALID_INPUT`).
|
|
609
601
|
*/
|
|
610
602
|
videoEncoders(options?: {
|
|
611
603
|
readonly videoQuality?: string;
|
|
612
604
|
}): Promise<Readonly<Record<NonNullable<BrowserExportOptions["videoCodec"]>, boolean>>>;
|
|
613
|
-
/**
|
|
614
|
-
* The proxies this browser keeps, for every project: each original's SHA-256 and the bytes its
|
|
615
|
-
* proxy takes.
|
|
616
|
-
*/
|
|
605
|
+
/** Proxies this browser keeps for all projects: each original's SHA-256 and its proxy's bytes. */
|
|
617
606
|
listProxies(): Promise<KeptProxy[]>;
|
|
618
607
|
/**
|
|
619
|
-
* Removes the kept proxies of `hashes` (originals' SHA-256). This session
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
* in `inUse`.
|
|
608
|
+
* Removes the kept proxies of `hashes` (originals' SHA-256). This session releases its own first
|
|
609
|
+
* and refreshes the preview; a proxy still read afterwards (by the preview for an offline
|
|
610
|
+
* original, by an export, or by another page of the origin) stays and is listed in `inUse`.
|
|
623
611
|
*/
|
|
624
612
|
removeProxies(hashes: Iterable<string>): Promise<ProxyRemoval>;
|
|
625
613
|
/**
|
|
@@ -655,8 +643,8 @@ export interface BrowserBridge {
|
|
|
655
643
|
selectAnimation(id: string, animation: string): void;
|
|
656
644
|
/**
|
|
657
645
|
* Reads an OpenEXR source's linear RGB in `primaries`, overriding what the file declares; `null`
|
|
658
|
-
* goes back to the file's.
|
|
659
|
-
*
|
|
646
|
+
* goes back to the file's. Throws `EditorError` `unsupported_media` for a source whose primaries
|
|
647
|
+
* cannot be chosen.
|
|
660
648
|
*/
|
|
661
649
|
setLinearPrimaries(id: string, primaries: import("alpha2").LinearPrimaries | null): void;
|
|
662
650
|
/**
|
|
@@ -666,9 +654,11 @@ export interface BrowserBridge {
|
|
|
666
654
|
* Throws synchronously when the bridge is disposed (`disposed`), another export runs
|
|
667
655
|
* (`export_busy`), `frameRate` is not one the engine reads (`invalid_frame_rate`), `videoDecode`
|
|
668
656
|
* is not `auto` or `software` (`invalid_video_decode`), `videoConversion` is not `engine` or
|
|
669
|
-
* `browser` (`invalid_video_conversion`), the asset
|
|
670
|
-
*
|
|
671
|
-
*
|
|
657
|
+
* `browser` (`invalid_video_conversion`), the asset decisions are not loaded (`conform_pending`),
|
|
658
|
+
* the media is not ready (`ConformError`), the document does not compile, or it shows an HDR
|
|
659
|
+
* source this browser previews only degraded (`unsupported_media`, its `cause` a
|
|
660
|
+
* `PlanarDecodeUnavailableError` naming the sources). Later failures arrive through the job's
|
|
661
|
+
* `result`.
|
|
672
662
|
*/
|
|
673
663
|
startExport(options?: BrowserExportOptions): ExportJob;
|
|
674
664
|
/**
|
|
@@ -689,11 +679,15 @@ export interface WorkerPreviewOptions {
|
|
|
689
679
|
readonly runtimeAssets?: RuntimeAssets;
|
|
690
680
|
/** A canvas to render into, transferred to the worker. */
|
|
691
681
|
readonly canvas?: OffscreenCanvas;
|
|
682
|
+
/** `engine` (the default) or `browser`; see `BrowserBridgeOptions.videoConversion`. */
|
|
683
|
+
readonly videoConversion?: "engine" | "browser";
|
|
692
684
|
/**
|
|
693
|
-
*
|
|
694
|
-
* `
|
|
685
|
+
* `present-degraded` shows an HDR source without planes through the browser's own conversion
|
|
686
|
+
* (`FrameSupply`'s `opaqueEngineFrames`); `refuse` (the default) fails its frames.
|
|
695
687
|
*/
|
|
696
|
-
readonly
|
|
688
|
+
readonly opaqueEngineFrames?: "refuse" | "present-degraded";
|
|
689
|
+
/** `"auto"` (the default: a hardware GPU, else the CPU renderer), `"gpu"` or `"cpu"`. */
|
|
690
|
+
readonly renderer?: "auto" | "gpu" | "cpu";
|
|
697
691
|
}
|
|
698
692
|
/** The main-thread side of a preview renderer running in a worker. */
|
|
699
693
|
export interface WorkerPreview {
|
|
@@ -709,16 +703,17 @@ export interface WorkerPreview {
|
|
|
709
703
|
renderSize: readonly [number, number] | null;
|
|
710
704
|
}>;
|
|
711
705
|
/**
|
|
712
|
-
* Renders the frame at `tick`. `rendered` is `false` for an empty project or a render
|
|
713
|
-
*
|
|
714
|
-
*
|
|
715
|
-
* `
|
|
716
|
-
*
|
|
717
|
-
* is newer than the one the last reply carried.
|
|
706
|
+
* Renders the frame at `tick`. `rendered` is `false` for an empty project or a render cancelled
|
|
707
|
+
* meanwhile. `unchanged` means the frame equals the one already shown, so nothing was drawn and
|
|
708
|
+
* no `bitmap` comes. `bitmap` is present only with `bitmapOutput`, and the caller owns it.
|
|
709
|
+
* `diagnostics` are the source decoders'; `engineDiagnostics` is the renderer's sample, present
|
|
710
|
+
* when newer than the one the last reply carried.
|
|
718
711
|
*/
|
|
719
712
|
seek(tick: number): Promise<{
|
|
720
713
|
rendered: boolean;
|
|
721
714
|
unchanged: boolean;
|
|
715
|
+
/** Sources the frame showed through the browser's own conversion. */
|
|
716
|
+
degradedSources: readonly string[];
|
|
722
717
|
bitmap?: ImageBitmap;
|
|
723
718
|
diagnostics: Readonly<Record<string, number>>;
|
|
724
719
|
engineDiagnostics?: Readonly<Record<string, unknown>>;
|