@aelionsdk/sdk 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/dist/audio-controller.d.ts +25 -0
  4. package/dist/audio-controller.d.ts.map +1 -0
  5. package/dist/audio-controller.js +235 -0
  6. package/dist/audio-mastering.d.ts +27 -0
  7. package/dist/audio-mastering.d.ts.map +1 -0
  8. package/dist/audio-mastering.js +160 -0
  9. package/dist/composition.d.ts +75 -0
  10. package/dist/composition.d.ts.map +1 -0
  11. package/dist/composition.js +146 -0
  12. package/dist/default-schemas.d.ts +7 -0
  13. package/dist/default-schemas.d.ts.map +1 -0
  14. package/dist/default-schemas.js +18 -0
  15. package/dist/export-job.d.ts +22 -0
  16. package/dist/export-job.d.ts.map +1 -0
  17. package/dist/export-job.js +126 -0
  18. package/dist/extension-host.d.ts +90 -0
  19. package/dist/extension-host.d.ts.map +1 -0
  20. package/dist/extension-host.js +367 -0
  21. package/dist/index.d.ts +18 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +19 -0
  24. package/dist/media-provider.d.ts +49 -0
  25. package/dist/media-provider.d.ts.map +1 -0
  26. package/dist/media-provider.js +388 -0
  27. package/dist/migration-materials.d.ts +10 -0
  28. package/dist/migration-materials.d.ts.map +1 -0
  29. package/dist/migration-materials.js +148 -0
  30. package/dist/migration.d.ts +109 -0
  31. package/dist/migration.d.ts.map +1 -0
  32. package/dist/migration.js +1232 -0
  33. package/dist/persistence.d.ts +73 -0
  34. package/dist/persistence.d.ts.map +1 -0
  35. package/dist/persistence.js +245 -0
  36. package/dist/player.d.ts +22 -0
  37. package/dist/player.d.ts.map +1 -0
  38. package/dist/player.js +522 -0
  39. package/dist/preview-controller.d.ts +62 -0
  40. package/dist/preview-controller.d.ts.map +1 -0
  41. package/dist/preview-controller.js +377 -0
  42. package/dist/preview-quality.d.ts +7 -0
  43. package/dist/preview-quality.d.ts.map +1 -0
  44. package/dist/preview-quality.js +8 -0
  45. package/dist/production-media-provider.d.ts +112 -0
  46. package/dist/production-media-provider.d.ts.map +1 -0
  47. package/dist/production-media-provider.js +749 -0
  48. package/dist/project-builder.d.ts +249 -0
  49. package/dist/project-builder.d.ts.map +1 -0
  50. package/dist/project-builder.js +953 -0
  51. package/dist/runtime-material-registry.d.ts +10 -0
  52. package/dist/runtime-material-registry.d.ts.map +1 -0
  53. package/dist/runtime-material-registry.js +23 -0
  54. package/dist/session.d.ts +29 -0
  55. package/dist/session.d.ts.map +1 -0
  56. package/dist/session.js +1114 -0
  57. package/dist/types.d.ts +392 -0
  58. package/dist/types.d.ts.map +1 -0
  59. package/dist/types.js +1 -0
  60. package/package.json +60 -0
@@ -0,0 +1,377 @@
1
+ function assertScale(value, name) {
2
+ if (!Number.isFinite(value) || value <= 0 || value > 1) {
3
+ throw new RangeError(`${name} must be greater than 0 and at most 1`);
4
+ }
5
+ return value;
6
+ }
7
+ function abortError(error) {
8
+ if (error instanceof DOMException && error.name === 'AbortError')
9
+ return true;
10
+ if (error !== null && typeof error === 'object') {
11
+ const diagnostics = Reflect.get(error, 'diagnostics');
12
+ if (Array.isArray(diagnostics)) {
13
+ const first = diagnostics[0];
14
+ return (first !== null &&
15
+ typeof first === 'object' &&
16
+ Reflect.get(first, 'code') === 'OPERATION_ABORTED');
17
+ }
18
+ }
19
+ return false;
20
+ }
21
+ class CanvasController {
22
+ #session;
23
+ #canvas;
24
+ #context;
25
+ #options;
26
+ #fit;
27
+ #background;
28
+ #targetFrameMs;
29
+ #adaptiveScales;
30
+ #resizeObserver;
31
+ #quality;
32
+ #renderScale;
33
+ #adaptiveIndex;
34
+ #unsubscribePlayer;
35
+ #controller;
36
+ #generation = 0;
37
+ #currentTimeUs = null;
38
+ #renderedFrames = 0;
39
+ #cancelledFrames = 0;
40
+ #failedFrames = 0;
41
+ #slowFrames = 0;
42
+ #fastFrames = 0;
43
+ #resumeWhenVisible = false;
44
+ #disposed = false;
45
+ constructor(session, canvas, options) {
46
+ const context = canvas.getContext('2d', { alpha: false, desynchronized: true });
47
+ if (context === null)
48
+ throw new Error('Canvas 2D context is unavailable');
49
+ this.#session = session;
50
+ this.#canvas = canvas;
51
+ this.#context = context;
52
+ this.#options = options;
53
+ this.#fit = options.fit ?? 'contain';
54
+ this.#background = options.background ?? '#000000';
55
+ this.#targetFrameMs = options.targetFrameMs ?? 1_000 / 30;
56
+ if (!Number.isFinite(this.#targetFrameMs) || this.#targetFrameMs <= 0) {
57
+ throw new RangeError('targetFrameMs must be positive');
58
+ }
59
+ const scales = options.adaptiveScales ?? [1, 0.75, 0.5, 0.35];
60
+ if (scales.length === 0)
61
+ throw new RangeError('adaptiveScales must not be empty');
62
+ this.#adaptiveScales = Object.freeze([...new Set(scales.map(value => assertScale(value, 'adaptive scale')))].sort((left, right) => right - left));
63
+ this.#quality = options.quality ?? 'adaptive';
64
+ const defaultScale = this.#quality === 'draft' ? 0.5 : 1;
65
+ this.#renderScale = assertScale(options.renderScale ?? defaultScale, 'renderScale');
66
+ this.#adaptiveIndex = this.#nearestAdaptiveIndex(this.#renderScale);
67
+ this.resize();
68
+ if (options.subscribePlayer ?? true) {
69
+ this.#unsubscribePlayer = session.player.subscribe(frame => this.#acceptPlayerFrame(frame));
70
+ this.#applyPlayerQuality();
71
+ }
72
+ if (typeof ResizeObserver === 'function') {
73
+ this.#resizeObserver = new ResizeObserver(() => {
74
+ if (this.#disposed)
75
+ return;
76
+ this.resize();
77
+ if ((options.renderOnResize ?? true) && this.#currentTimeUs !== null) {
78
+ void this.render(this.#currentTimeUs).catch((error) => this.#reportError(error));
79
+ }
80
+ });
81
+ this.#resizeObserver.observe(canvas);
82
+ }
83
+ if ((options.pauseWhenHidden ?? true) && typeof document !== 'undefined') {
84
+ document.addEventListener('visibilitychange', this.#onVisibilityChange);
85
+ }
86
+ if (options.onPointer !== undefined) {
87
+ canvas.addEventListener('pointerdown', this.#onPointer);
88
+ canvas.addEventListener('pointermove', this.#onPointer);
89
+ canvas.addEventListener('pointerup', this.#onPointer);
90
+ canvas.addEventListener('pointercancel', this.#onPointer);
91
+ }
92
+ }
93
+ async render(timeUs) {
94
+ this.#assertActive();
95
+ if (!Number.isSafeInteger(timeUs) || timeUs < 0) {
96
+ throw new RangeError('timeUs must be a non-negative safe integer');
97
+ }
98
+ const generation = ++this.#generation;
99
+ this.#controller?.abort(new DOMException('Preview render superseded', 'AbortError'));
100
+ const controller = new AbortController();
101
+ this.#controller = controller;
102
+ const startedAt = performance.now();
103
+ try {
104
+ const result = await this.#session.preview.renderFrame({
105
+ timeUs,
106
+ signal: controller.signal,
107
+ quality: this.#quality === 'full' ? 'full' : 'draft',
108
+ renderScale: this.#renderScale,
109
+ });
110
+ if (generation !== this.#generation || this.#disposed) {
111
+ result.bitmap.close();
112
+ this.#cancelledFrames += 1;
113
+ return;
114
+ }
115
+ this.#currentTimeUs = timeUs;
116
+ this.#draw(result, timeUs);
117
+ this.#observePerformance(performance.now() - startedAt, false);
118
+ }
119
+ catch (error) {
120
+ if (abortError(error) || controller.signal.aborted) {
121
+ this.#cancelledFrames += 1;
122
+ return;
123
+ }
124
+ this.#failedFrames += 1;
125
+ this.#reportError(error);
126
+ throw error;
127
+ }
128
+ finally {
129
+ if (this.#controller === controller)
130
+ this.#controller = undefined;
131
+ }
132
+ }
133
+ setQuality(quality, renderScale) {
134
+ this.#assertActive();
135
+ this.#quality = quality;
136
+ this.#renderScale = assertScale(renderScale ?? (quality === 'draft' ? 0.5 : quality === 'full' ? 1 : this.#renderScale), 'renderScale');
137
+ this.#adaptiveIndex = this.#nearestAdaptiveIndex(this.#renderScale);
138
+ this.#slowFrames = 0;
139
+ this.#fastFrames = 0;
140
+ this.#applyPlayerQuality();
141
+ }
142
+ resize() {
143
+ this.#assertActive();
144
+ const devicePixelRatio = Reflect.get(globalThis, 'devicePixelRatio');
145
+ const pixelRatio = this.#options.pixelRatio ?? (typeof devicePixelRatio === 'number' ? devicePixelRatio : 1);
146
+ if (!Number.isFinite(pixelRatio) || pixelRatio <= 0 || pixelRatio > 8) {
147
+ throw new RangeError('pixelRatio must be greater than 0 and at most 8');
148
+ }
149
+ const snapshot = this.#session.getSnapshot();
150
+ const fallbackWidth = snapshot.renderIr?.width ?? (this.#canvas.width || 1);
151
+ const fallbackHeight = snapshot.renderIr?.height ?? (this.#canvas.height || 1);
152
+ const cssWidth = this.#canvas.clientWidth || fallbackWidth;
153
+ const cssHeight = this.#canvas.clientHeight || fallbackHeight;
154
+ const width = Math.max(1, Math.round(cssWidth * pixelRatio));
155
+ const height = Math.max(1, Math.round(cssHeight * pixelRatio));
156
+ if (this.#canvas.width !== width)
157
+ this.#canvas.width = width;
158
+ if (this.#canvas.height !== height)
159
+ this.#canvas.height = height;
160
+ }
161
+ toProjectPoint(clientX, clientY) {
162
+ this.#assertActive();
163
+ if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
164
+ throw new RangeError('Canvas coordinates must be finite');
165
+ }
166
+ const bounds = this.#canvas.getBoundingClientRect();
167
+ const cssWidth = bounds.width || this.#canvas.width;
168
+ const cssHeight = bounds.height || this.#canvas.height;
169
+ const canvasX = (clientX - bounds.left) * (this.#canvas.width / cssWidth);
170
+ const canvasY = (clientY - bounds.top) * (this.#canvas.height / cssHeight);
171
+ const renderIr = this.#session.getSnapshot().renderIr;
172
+ const projectWidth = renderIr?.width ?? this.#canvas.width;
173
+ const projectHeight = renderIr?.height ?? this.#canvas.height;
174
+ if (this.#fit === 'fill') {
175
+ const x = (canvasX / this.#canvas.width) * projectWidth;
176
+ const y = (canvasY / this.#canvas.height) * projectHeight;
177
+ return {
178
+ x,
179
+ y,
180
+ inside: x >= 0 && x <= projectWidth && y >= 0 && y <= projectHeight,
181
+ };
182
+ }
183
+ const scale = this.#fit === 'cover'
184
+ ? Math.max(this.#canvas.width / projectWidth, this.#canvas.height / projectHeight)
185
+ : Math.min(this.#canvas.width / projectWidth, this.#canvas.height / projectHeight);
186
+ const contentWidth = projectWidth * scale;
187
+ const contentHeight = projectHeight * scale;
188
+ const offsetX = (this.#canvas.width - contentWidth) / 2;
189
+ const offsetY = (this.#canvas.height - contentHeight) / 2;
190
+ const x = (canvasX - offsetX) / scale;
191
+ const y = (canvasY - offsetY) / scale;
192
+ return {
193
+ x,
194
+ y,
195
+ inside: x >= 0 && x <= projectWidth && y >= 0 && y <= projectHeight,
196
+ };
197
+ }
198
+ captureStream(frameRate = 30) {
199
+ this.#assertActive();
200
+ if (!Number.isFinite(frameRate) || frameRate <= 0 || frameRate > 240) {
201
+ throw new RangeError('frameRate must be greater than 0 and at most 240');
202
+ }
203
+ if (typeof this.#canvas.captureStream !== 'function') {
204
+ throw new Error('HTMLCanvasElement.captureStream is unavailable');
205
+ }
206
+ return this.#canvas.captureStream(frameRate);
207
+ }
208
+ snapshot() {
209
+ return Object.freeze({
210
+ disposed: this.#disposed,
211
+ pending: this.#controller !== undefined,
212
+ generation: this.#generation,
213
+ currentTimeUs: this.#currentTimeUs,
214
+ quality: this.#quality,
215
+ renderScale: this.#renderScale,
216
+ renderedFrames: this.#renderedFrames,
217
+ cancelledFrames: this.#cancelledFrames,
218
+ failedFrames: this.#failedFrames,
219
+ canvasWidth: this.#canvas.width,
220
+ canvasHeight: this.#canvas.height,
221
+ });
222
+ }
223
+ dispose() {
224
+ if (this.#disposed)
225
+ return;
226
+ this.#disposed = true;
227
+ this.#generation += 1;
228
+ this.#controller?.abort(new DOMException('Preview Canvas Controller disposed', 'AbortError'));
229
+ this.#controller = undefined;
230
+ this.#unsubscribePlayer?.();
231
+ this.#unsubscribePlayer = undefined;
232
+ this.#resizeObserver?.disconnect();
233
+ if (typeof document !== 'undefined') {
234
+ document.removeEventListener('visibilitychange', this.#onVisibilityChange);
235
+ }
236
+ if (this.#options.onPointer !== undefined) {
237
+ this.#canvas.removeEventListener('pointerdown', this.#onPointer);
238
+ this.#canvas.removeEventListener('pointermove', this.#onPointer);
239
+ this.#canvas.removeEventListener('pointerup', this.#onPointer);
240
+ this.#canvas.removeEventListener('pointercancel', this.#onPointer);
241
+ }
242
+ }
243
+ #acceptPlayerFrame(frame) {
244
+ if (this.#disposed) {
245
+ frame.result.bitmap.close();
246
+ return;
247
+ }
248
+ this.#generation = Math.max(this.#generation, frame.generation);
249
+ this.#currentTimeUs = frame.timestampUs;
250
+ this.#draw(frame.result, frame.timestampUs);
251
+ this.#observePerformance(0, frame.droppedFrames > 0);
252
+ }
253
+ #draw(result, timeUs) {
254
+ try {
255
+ const canvasWidth = this.#canvas.width;
256
+ const canvasHeight = this.#canvas.height;
257
+ this.#context.save();
258
+ try {
259
+ this.#context.fillStyle = this.#background;
260
+ this.#context.fillRect(0, 0, canvasWidth, canvasHeight);
261
+ if (this.#fit === 'fill') {
262
+ this.#context.drawImage(result.bitmap, 0, 0, canvasWidth, canvasHeight);
263
+ }
264
+ else {
265
+ const scale = this.#fit === 'cover'
266
+ ? Math.max(canvasWidth / result.width, canvasHeight / result.height)
267
+ : Math.min(canvasWidth / result.width, canvasHeight / result.height);
268
+ const width = result.width * scale;
269
+ const height = result.height * scale;
270
+ this.#context.drawImage(result.bitmap, (canvasWidth - width) / 2, (canvasHeight - height) / 2, width, height);
271
+ }
272
+ }
273
+ finally {
274
+ this.#context.restore();
275
+ }
276
+ this.#renderedFrames += 1;
277
+ this.#options.onFrame?.({
278
+ timeUs,
279
+ width: result.width,
280
+ height: result.height,
281
+ renderScale: result.renderScale,
282
+ backend: result.backend,
283
+ });
284
+ }
285
+ finally {
286
+ result.bitmap.close();
287
+ }
288
+ }
289
+ #observePerformance(elapsedMs, dropped) {
290
+ if (this.#quality !== 'adaptive')
291
+ return;
292
+ const slow = dropped || elapsedMs > this.#targetFrameMs * 1.2;
293
+ if (slow) {
294
+ this.#slowFrames += 1;
295
+ this.#fastFrames = 0;
296
+ if (this.#slowFrames >= 3 && this.#adaptiveIndex < this.#adaptiveScales.length - 1) {
297
+ this.#adaptiveIndex += 1;
298
+ this.#renderScale = this.#adaptiveScales[this.#adaptiveIndex] ?? this.#renderScale;
299
+ this.#slowFrames = 0;
300
+ this.#applyPlayerQuality();
301
+ }
302
+ return;
303
+ }
304
+ this.#fastFrames += 1;
305
+ this.#slowFrames = 0;
306
+ if (this.#fastFrames >= 30 && this.#adaptiveIndex > 0) {
307
+ this.#adaptiveIndex -= 1;
308
+ this.#renderScale = this.#adaptiveScales[this.#adaptiveIndex] ?? this.#renderScale;
309
+ this.#fastFrames = 0;
310
+ this.#applyPlayerQuality();
311
+ }
312
+ }
313
+ #applyPlayerQuality() {
314
+ this.#session.player.setPreviewQuality({
315
+ quality: this.#quality === 'full' ? 'full' : 'draft',
316
+ renderScale: this.#renderScale,
317
+ });
318
+ }
319
+ #nearestAdaptiveIndex(scale) {
320
+ let selected = 0;
321
+ let distance = Number.POSITIVE_INFINITY;
322
+ for (let index = 0; index < this.#adaptiveScales.length; index += 1) {
323
+ const candidate = this.#adaptiveScales[index];
324
+ if (candidate === undefined)
325
+ continue;
326
+ const nextDistance = Math.abs(candidate - scale);
327
+ if (nextDistance < distance) {
328
+ selected = index;
329
+ distance = nextDistance;
330
+ }
331
+ }
332
+ return selected;
333
+ }
334
+ #onVisibilityChange = () => {
335
+ if (this.#disposed || typeof document === 'undefined')
336
+ return;
337
+ if (document.hidden) {
338
+ this.#resumeWhenVisible = this.#session.player.state === 'playing';
339
+ if (this.#resumeWhenVisible) {
340
+ void this.#session.player.pause().catch((error) => this.#reportError(error));
341
+ }
342
+ return;
343
+ }
344
+ if (this.#resumeWhenVisible) {
345
+ this.#resumeWhenVisible = false;
346
+ void this.#session.player.play().catch((error) => this.#reportError(error));
347
+ }
348
+ };
349
+ #onPointer = (event) => {
350
+ if (this.#disposed)
351
+ return;
352
+ const type = event.type === 'pointerdown'
353
+ ? 'down'
354
+ : event.type === 'pointerup'
355
+ ? 'up'
356
+ : event.type === 'pointercancel'
357
+ ? 'cancel'
358
+ : 'move';
359
+ this.#options.onPointer?.({
360
+ type,
361
+ point: this.toProjectPoint(event.clientX, event.clientY),
362
+ pointerId: event.pointerId,
363
+ buttons: event.buttons,
364
+ originalEvent: event,
365
+ });
366
+ };
367
+ #reportError(error) {
368
+ this.#options.onError?.(error);
369
+ }
370
+ #assertActive() {
371
+ if (this.#disposed)
372
+ throw new ReferenceError('Preview Canvas Controller is disposed');
373
+ }
374
+ }
375
+ export function attachPreviewCanvas(session, canvas, options = {}) {
376
+ return new CanvasController(session, canvas, options);
377
+ }
@@ -0,0 +1,7 @@
1
+ import type { AelionPreviewQualityOptions } from './types.js';
2
+ export interface NormalizedPreviewQuality {
3
+ readonly quality: 'draft' | 'full';
4
+ readonly renderScale: number;
5
+ }
6
+ export declare function normalizePreviewQuality(options?: AelionPreviewQualityOptions): NormalizedPreviewQuality;
7
+ //# sourceMappingURL=preview-quality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-quality.d.ts","sourceRoot":"","sources":["../src/preview-quality.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,uBAAuB,CACrC,OAAO,GAAE,2BAAgC,GACxC,wBAAwB,CAO1B"}
@@ -0,0 +1,8 @@
1
+ export function normalizePreviewQuality(options = {}) {
2
+ const quality = options.quality ?? 'full';
3
+ const renderScale = options.renderScale ?? (quality === 'draft' ? 0.5 : 1);
4
+ if (!Number.isFinite(renderScale) || renderScale <= 0 || renderScale > 1) {
5
+ throw new RangeError('renderScale must be greater than 0 and at most 1');
6
+ }
7
+ return Object.freeze({ quality, renderScale });
8
+ }
@@ -0,0 +1,112 @@
1
+ import type { PcmSourceBlock } from '@aelionsdk/audio';
2
+ import { PageMediaResourceGovernor, type CacheStore, type FetchRangeReaderOptions, type MediaResourceGovernorSnapshot, type RangeReader, type SampleIndex } from '@aelionsdk/media';
3
+ import type { AelionMediaProvider, AelionMediaRequest } from './types.js';
4
+ export type ProductionMediaRole = 'original' | 'proxy' | 'thumbnail' | 'waveform';
5
+ export interface ProductionMediaRepresentationOptions {
6
+ /** Stable representation id. Defaults to `${assetId}:${role}`. */
7
+ readonly id?: string;
8
+ readonly role?: ProductionMediaRole;
9
+ readonly durationUs?: number;
10
+ readonly width?: number;
11
+ readonly height?: number;
12
+ /** Optional lowercase SHA-256. Enables content-addressed persistent SampleIndex reuse. */
13
+ readonly contentHash?: string;
14
+ readonly sourceStartUs?: number;
15
+ /** Explicitly marks a range-backed representation as a still image. */
16
+ readonly kind?: 'media' | 'image';
17
+ readonly mimeType?: string;
18
+ }
19
+ export interface ProductionMediaUrlOptions extends ProductionMediaRepresentationOptions, FetchRangeReaderOptions {
20
+ }
21
+ export interface ProductionMediaProviderOptions {
22
+ /** Persistent or tiered cache. A bounded memory cache is used by default. */
23
+ readonly cache?: CacheStore;
24
+ /** Shared page-level budget. A provider-owned governor is created by default. */
25
+ readonly governor?: PageMediaResourceGovernor;
26
+ readonly maxCachedIndexes?: number;
27
+ readonly maxCachedIndexBytes?: number;
28
+ readonly maxDecodeSessions?: number;
29
+ readonly maxCachedVideoFramesPerSession?: number;
30
+ readonly maxCachedVideoBytesPerSession?: number;
31
+ readonly maxSequentialDecodeGapUs?: number;
32
+ readonly maxCachedImages?: number;
33
+ readonly maxCachedImageBytes?: number;
34
+ readonly maxImageDecodeBytes?: number;
35
+ readonly maxConcurrentOperations?: number;
36
+ readonly maxPendingOperations?: number;
37
+ }
38
+ export interface ProductionMediaSelection {
39
+ readonly assetId: string;
40
+ readonly representationId: string;
41
+ readonly role: ProductionMediaRole;
42
+ readonly usedProxy: boolean;
43
+ readonly diagnostics: readonly string[];
44
+ }
45
+ export interface ProductionMediaProbe extends ProductionMediaSelection {
46
+ readonly index: SampleIndex;
47
+ }
48
+ export interface ProductionMediaProviderSnapshot {
49
+ readonly assets: number;
50
+ readonly representations: number;
51
+ readonly cachedIndexes: number;
52
+ readonly cachedIndexBytes: number;
53
+ readonly maxCachedIndexes: number;
54
+ readonly maxCachedIndexBytes: number;
55
+ readonly decodeSessions: number;
56
+ readonly activeDecodeSessions: number;
57
+ readonly maxDecodeSessions: number;
58
+ readonly cachedVideoFrames: number;
59
+ readonly cachedVideoBytes: number;
60
+ readonly maxCachedVideoFramesPerSession: number;
61
+ readonly maxCachedVideoBytesPerSession: number;
62
+ readonly maxSequentialDecodeGapUs: number;
63
+ readonly decodeCacheHits: number;
64
+ readonly decodeCacheMisses: number;
65
+ readonly decodeSeeks: number;
66
+ readonly sequentialDecodedFrames: number;
67
+ readonly cachedImages: number;
68
+ readonly cachedImageBytes: number;
69
+ readonly maxCachedImages: number;
70
+ readonly maxCachedImageBytes: number;
71
+ readonly maxImageDecodeBytes: number;
72
+ readonly imageCacheHits: number;
73
+ readonly imageCacheMisses: number;
74
+ readonly activeOperations: number;
75
+ readonly pendingOperations: number;
76
+ readonly maxConcurrentOperations: number;
77
+ readonly maxPendingOperations: number;
78
+ readonly governor: MediaResourceGovernorSnapshot;
79
+ readonly cache: ReturnType<CacheStore['snapshot']>;
80
+ readonly disposed: boolean;
81
+ }
82
+ /**
83
+ * Range-backed media provider for File/Blob, URL and OPFS sources.
84
+ *
85
+ * It keeps whole media out of JavaScript memory, reuses content-addressed
86
+ * SampleIndexes, chooses preview proxies, and bounds decoder work across a page.
87
+ */
88
+ export declare class ProductionMediaProvider implements AelionMediaProvider {
89
+ #private;
90
+ constructor(options?: ProductionMediaProviderOptions);
91
+ registerReader(assetId: string, reader: RangeReader, options?: ProductionMediaRepresentationOptions): void;
92
+ registerBlob(assetId: string, blob: Blob, options?: ProductionMediaRepresentationOptions): void;
93
+ registerFile(assetId: string, file: File, options?: ProductionMediaRepresentationOptions): void;
94
+ registerImageBlob(assetId: string, blob: Blob, options?: ProductionMediaRepresentationOptions): void;
95
+ registerImageFile(assetId: string, file: File, options?: ProductionMediaRepresentationOptions): void;
96
+ registerUrl(assetId: string, url: string, options?: ProductionMediaUrlOptions): void;
97
+ registerOpfs(assetId: string, path: string, options?: ProductionMediaRepresentationOptions): Promise<void>;
98
+ unregister(assetId: string): boolean;
99
+ representationFor(assetId: string, request?: Partial<AelionMediaRequest> & {
100
+ readonly purpose?: 'preview' | 'export';
101
+ }): ProductionMediaSelection;
102
+ probe(assetId: string, options?: Partial<AelionMediaRequest> & {
103
+ readonly signal?: AbortSignal;
104
+ }): Promise<ProductionMediaProbe>;
105
+ frameAt(assetId: string, streamIndex: number, sourceTimeUs: number, signal?: AbortSignal, request?: AelionMediaRequest): Promise<VideoFrame>;
106
+ pcmRange(assetId: string, streamIndex: number, startUs: number, durationUs: number, signal?: AbortSignal): Promise<PcmSourceBlock>;
107
+ clear(): void;
108
+ registerImageUrl(assetId: string, url: string, options?: ProductionMediaUrlOptions): void;
109
+ snapshot(): ProductionMediaProviderSnapshot;
110
+ dispose(): void;
111
+ }
112
+ //# sourceMappingURL=production-media-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"production-media-provider.d.ts","sourceRoot":"","sources":["../src/production-media-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAIL,yBAAyB,EASzB,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,WAAW,EAChB,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAI1E,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC;AAElF,MAAM,WAAW,oCAAoC;IACnD,kEAAkE;IAClE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,mBAA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