@mediafox/core 1.2.1 → 1.2.3

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.
@@ -0,0 +1,179 @@
1
+ import type { MediaSource } from '../types';
2
+ import type { CompositorEventListener, CompositorEventMap, CompositorOptions, CompositorSource, CompositorSourceOptions, CompositionFrame, FrameExportOptions, PreviewOptions } from './types';
3
+ /**
4
+ * Canvas-based video compositor for composing multiple media sources into a single output.
5
+ * Supports layered rendering with transforms, opacity, and rotation.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const compositor = new Compositor({
10
+ * canvas: document.querySelector('canvas'),
11
+ * width: 1920,
12
+ * height: 1080
13
+ * });
14
+ *
15
+ * const source = await compositor.loadSource('video.mp4');
16
+ * compositor.preview({
17
+ * duration: 10,
18
+ * getComposition: (time) => ({
19
+ * time,
20
+ * layers: [{ source, transform: { opacity: 1 } }]
21
+ * })
22
+ * });
23
+ * compositor.play();
24
+ * ```
25
+ */
26
+ export declare class Compositor {
27
+ private canvas;
28
+ private ctx;
29
+ private width;
30
+ private height;
31
+ private backgroundColor;
32
+ private sourcePool;
33
+ private emitter;
34
+ private state;
35
+ private animationFrameId;
36
+ private lastFrameTime;
37
+ private previewOptions;
38
+ private disposed;
39
+ private renderBuffers;
40
+ private lastTimeUpdateEmit;
41
+ private timeUpdateThrottleMs;
42
+ private renderPending;
43
+ /**
44
+ * Creates a new Compositor instance.
45
+ * @param options - Configuration options for the compositor
46
+ */
47
+ constructor(options: CompositorOptions);
48
+ /**
49
+ * Loads a video source into the compositor's source pool.
50
+ * @param source - Video source (URL, File, Blob, or MediaStream)
51
+ * @param options - Optional loading configuration
52
+ * @returns The loaded compositor source
53
+ */
54
+ loadSource(source: MediaSource, options?: CompositorSourceOptions): Promise<CompositorSource>;
55
+ /**
56
+ * Loads an image source into the compositor's source pool.
57
+ * @param source - Image source (URL, File, or Blob)
58
+ * @returns The loaded compositor source
59
+ */
60
+ loadImage(source: string | Blob | File): Promise<CompositorSource>;
61
+ /**
62
+ * Loads an audio source into the compositor's source pool.
63
+ * @param source - Audio source (URL, File, Blob, or MediaStream)
64
+ * @param options - Optional loading configuration
65
+ * @returns The loaded compositor source
66
+ */
67
+ loadAudio(source: MediaSource, options?: CompositorSourceOptions): Promise<CompositorSource>;
68
+ /**
69
+ * Unloads a source from the compositor's source pool.
70
+ * @param id - The source ID to unload
71
+ * @returns True if the source was found and unloaded
72
+ */
73
+ unloadSource(id: string): boolean;
74
+ /**
75
+ * Gets a source by ID from the source pool.
76
+ * @param id - The source ID
77
+ * @returns The source if found, undefined otherwise
78
+ */
79
+ getSource(id: string): CompositorSource | undefined;
80
+ /**
81
+ * Gets all sources currently loaded in the source pool.
82
+ * @returns Array of all loaded sources
83
+ */
84
+ getAllSources(): CompositorSource[];
85
+ /**
86
+ * Renders a composition frame to the canvas.
87
+ * Fetches all layer frames in parallel before drawing to prevent flicker.
88
+ * @param frame - The composition frame to render
89
+ * @returns True if rendering succeeded
90
+ */
91
+ render(frame: CompositionFrame): Promise<boolean>;
92
+ private renderLayer;
93
+ /**
94
+ * Clears the canvas with the background color.
95
+ */
96
+ clear(): void;
97
+ /**
98
+ * Configures the preview playback with a composition callback.
99
+ * Must be called before play() or seek().
100
+ * @param options - Preview configuration including duration and composition callback
101
+ */
102
+ preview(options: PreviewOptions): void;
103
+ /**
104
+ * Starts playback of the preview composition.
105
+ * @throws Error if preview() has not been called first
106
+ */
107
+ play(): Promise<void>;
108
+ /**
109
+ * Pauses playback of the preview composition.
110
+ */
111
+ pause(): void;
112
+ /**
113
+ * Seeks to a specific time in the preview composition.
114
+ * @param time - Time in seconds to seek to
115
+ */
116
+ seek(time: number): Promise<void>;
117
+ private startRenderLoop;
118
+ private stopRenderLoop;
119
+ /**
120
+ * Exports a single frame at the specified time as an image blob.
121
+ * @param time - Time in seconds to export
122
+ * @param options - Export options (format, quality)
123
+ * @returns Image blob or null if export failed
124
+ */
125
+ exportFrame(time: number, options?: FrameExportOptions): Promise<Blob | null>;
126
+ /** Current playback time in seconds. */
127
+ get currentTime(): number;
128
+ /** Total duration of the preview composition in seconds. */
129
+ get duration(): number;
130
+ /** Whether the compositor is currently playing. */
131
+ get playing(): boolean;
132
+ /** Whether the compositor is currently paused. */
133
+ get paused(): boolean;
134
+ /** Whether the compositor is currently seeking. */
135
+ get seeking(): boolean;
136
+ /**
137
+ * Gets the current canvas width.
138
+ * @returns Width in pixels
139
+ */
140
+ getWidth(): number;
141
+ /**
142
+ * Gets the current canvas height.
143
+ * @returns Height in pixels
144
+ */
145
+ getHeight(): number;
146
+ /**
147
+ * Resizes the compositor canvas without disposing loaded sources.
148
+ * @param width - New width in pixels
149
+ * @param height - New height in pixels
150
+ */
151
+ resize(width: number, height: number): void;
152
+ /**
153
+ * Subscribes to a compositor event.
154
+ * @param event - Event name to listen for
155
+ * @param listener - Callback function
156
+ * @returns Unsubscribe function
157
+ */
158
+ on<K extends keyof CompositorEventMap>(event: K, listener: CompositorEventListener<K>): () => void;
159
+ /**
160
+ * Subscribes to a compositor event for a single invocation.
161
+ * @param event - Event name to listen for
162
+ * @param listener - Callback function
163
+ * @returns Unsubscribe function
164
+ */
165
+ once<K extends keyof CompositorEventMap>(event: K, listener: CompositorEventListener<K>): () => void;
166
+ /**
167
+ * Unsubscribes from a compositor event.
168
+ * @param event - Event name to unsubscribe from
169
+ * @param listener - Optional specific listener to remove
170
+ */
171
+ off<K extends keyof CompositorEventMap>(event: K, listener?: CompositorEventListener<K>): void;
172
+ private checkDisposed;
173
+ /**
174
+ * Disposes the compositor and releases all resources.
175
+ * After disposal, the compositor cannot be used.
176
+ */
177
+ dispose(): void;
178
+ }
179
+ //# sourceMappingURL=compositor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compositor.d.ts","sourceRoot":"","sources":["../../src/compositor/compositor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,KAAK,EACV,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AAE,CAAC,EACR,QAAQ,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACnC,MAAM,IAAI;IAIb;;;;OAIG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,kBAAkB,EACpC,KAAK,EAAE,CAAC,EACR,QAAQ,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACpC,IAAI;IAMP,OAAO,CAAC,aAAa;IAMrB;;;OAGG;IACH,OAAO,IAAI,IAAI;CAUhB"}
@@ -0,0 +1,4 @@
1
+ export { Compositor } from './compositor';
2
+ export { SourcePool } from './source-pool';
3
+ export type { AudioLayer, CompositionFrame, CompositionProvider, CompositorEventListener, CompositorEventMap, CompositorLayer, CompositorOptions, CompositorRendererType, CompositorSource, CompositorSourceOptions, FrameExportOptions, LayerTransform, PreviewOptions, SourceType, } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compositor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,UAAU,GACX,MAAM,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { MediaSource } from '../types';
2
+ import type { CompositorSource, CompositorSourceOptions } from './types';
3
+ export declare class SourcePool {
4
+ private sources;
5
+ private audioContext;
6
+ private nextId;
7
+ constructor(audioContext?: AudioContext);
8
+ private generateId;
9
+ loadVideo(source: MediaSource, options?: CompositorSourceOptions): Promise<CompositorSource>;
10
+ loadImage(source: string | Blob | File): Promise<CompositorSource>;
11
+ loadAudio(source: MediaSource, options?: CompositorSourceOptions): Promise<CompositorSource>;
12
+ private createInput;
13
+ getSource(id: string): CompositorSource | undefined;
14
+ hasSource(id: string): boolean;
15
+ unloadSource(id: string): boolean;
16
+ getAllSources(): CompositorSource[];
17
+ clear(): void;
18
+ dispose(): void;
19
+ }
20
+ //# sourceMappingURL=source-pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-pool.d.ts","sourceRoot":"","sources":["../../src/compositor/source-pool.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAc,MAAM,SAAS,CAAC;AAiLrF,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,MAAM,CAAK;gBAEP,YAAY,CAAC,EAAE,YAAY;IAIvC,OAAO,CAAC,UAAU;IAIZ,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiEhG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwBlE,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAoCtG,OAAO,CAAC,WAAW;IA0BnB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAInD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI9B,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAUjC,aAAa,IAAI,gBAAgB,EAAE;IAInC,KAAK,IAAI,IAAI;IAOb,OAAO,IAAI,IAAI;CAOhB"}
@@ -0,0 +1,92 @@
1
+ import type { RendererType, Rotation } from '../types';
2
+ export type CompositorRendererType = RendererType;
3
+ export interface CompositorOptions {
4
+ canvas: HTMLCanvasElement | OffscreenCanvas;
5
+ width?: number;
6
+ height?: number;
7
+ renderer?: CompositorRendererType;
8
+ backgroundColor?: string;
9
+ }
10
+ export interface LayerTransform {
11
+ x?: number;
12
+ y?: number;
13
+ width?: number;
14
+ height?: number;
15
+ rotation?: Rotation;
16
+ scaleX?: number;
17
+ scaleY?: number;
18
+ opacity?: number;
19
+ anchorX?: number;
20
+ anchorY?: number;
21
+ }
22
+ export interface CompositorLayer {
23
+ source: CompositorSource;
24
+ sourceTime?: number;
25
+ transform?: LayerTransform;
26
+ visible?: boolean;
27
+ zIndex?: number;
28
+ }
29
+ export interface AudioLayer {
30
+ source: CompositorSource;
31
+ sourceTime?: number;
32
+ volume?: number;
33
+ pan?: number;
34
+ muted?: boolean;
35
+ }
36
+ export interface CompositionFrame {
37
+ time: number;
38
+ layers: CompositorLayer[];
39
+ audio?: AudioLayer[];
40
+ }
41
+ export type CompositionProvider = (time: number) => CompositionFrame;
42
+ export interface PreviewOptions {
43
+ getComposition: CompositionProvider;
44
+ duration: number;
45
+ fps?: number;
46
+ loop?: boolean;
47
+ }
48
+ export interface FrameExportOptions {
49
+ format?: 'png' | 'jpeg' | 'webp';
50
+ quality?: number;
51
+ }
52
+ export type SourceType = 'video' | 'image' | 'audio';
53
+ export interface CompositorSource {
54
+ id: string;
55
+ type: SourceType;
56
+ duration: number;
57
+ width?: number;
58
+ height?: number;
59
+ getFrameAt(time: number): Promise<CanvasImageSource | null>;
60
+ getAudioAt?(time: number, duration: number): Promise<AudioBuffer | null>;
61
+ dispose(): void;
62
+ }
63
+ export interface CompositorSourceOptions {
64
+ id?: string;
65
+ startTime?: number;
66
+ endTime?: number;
67
+ }
68
+ export type CompositorEventMap = {
69
+ play: undefined;
70
+ pause: undefined;
71
+ seeking: {
72
+ time: number;
73
+ };
74
+ seeked: {
75
+ time: number;
76
+ };
77
+ timeupdate: {
78
+ currentTime: number;
79
+ };
80
+ ended: undefined;
81
+ error: Error;
82
+ sourceloaded: {
83
+ id: string;
84
+ source: CompositorSource;
85
+ };
86
+ sourceunloaded: {
87
+ id: string;
88
+ };
89
+ compositionchange: undefined;
90
+ };
91
+ export type CompositorEventListener<K extends keyof CompositorEventMap> = (event: CompositorEventMap[K]) => void;
92
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compositor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAA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,uBAAuB;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,UAAU,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,gBAAgB,CAAA;KAAE,CAAC;IACvD,cAAc,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,iBAAiB,EAAE,SAAS,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,MAAM,kBAAkB,IAAI,CACxE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KACzB,IAAI,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { Compositor, SourcePool } from './compositor';
2
+ export type { AudioLayer, CompositionFrame, CompositionProvider, CompositorEventListener, CompositorEventMap, CompositorLayer, CompositorOptions, CompositorRendererType, CompositorSource, CompositorSourceOptions, FrameExportOptions, LayerTransform, PreviewOptions, SourceType, } from './compositor';
1
3
  export type { AttachedImage, AudioCodec, AudioSample, EncodedPacket, InputFormat, MetadataTags, OutputFormat, Quality, SubtitleCodec, VideoCodec, VideoSample, } from 'mediabunny';
2
4
  export { EventEmitter } from './events/emitter';
3
5
  export type { TypedEventEmitter, UnsubscribeFn } from './events/types';
@@ -16,7 +18,7 @@ export { Store } from './state/store';
16
18
  export type { StateListener, StateStore, StateUnsubscribe } from './state/types';
17
19
  export { TrackManager } from './tracks/manager';
18
20
  export type { TrackManagerState, TrackSelectionEvent } from './tracks/types';
19
- export type { AudioTrackInfo, ChapterInfo, CuePoint, LoadOptions, MediaInfo, MediaSource, PerformanceMetrics, PlaybackMode, PlayerEventListener, PlayerEventMap, PlayerOptions, PlayerState, PlayerStateData, Playlist, PlaylistItem, PlaylistMode, QualityLevel, RendererType, ScreenshotOptions, SeekOptions, Subscription, SubtitleTrackInfo, TimeRange, VideoTrackInfo, } from './types';
21
+ export type { AudioTrackInfo, ChapterInfo, CuePoint, LoadOptions, MediaInfo, MediaSource, PerformanceMetrics, PlaybackMode, PlayerEventListener, PlayerEventMap, PlayerOptions, PlayerState, PlayerStateData, Playlist, PlaylistItem, PlaylistMode, QualityLevel, RendererType, Rotation, ScreenshotOptions, SeekOptions, Subscription, SubtitleTrackInfo, TimeRange, VideoTrackInfo, } from './types';
20
22
  export { ErrorCode, MediaFoxError, wrapError, } from './utils/errors';
21
23
  export { clamp, findBufferedRange, formatTime, frameToTime, mergeTimeRanges, parseTime, timeRangesOverlap, timeToFrame, totalBufferedDuration, } from './utils/time';
22
24
  export declare const VERSION = "0.1.0";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,aAAa,EACb,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,YAAY,EACV,UAAU,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