@mediafox/core 1.2.0 → 1.2.2

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,175 @@
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
+ /**
40
+ * Creates a new Compositor instance.
41
+ * @param options - Configuration options for the compositor
42
+ */
43
+ constructor(options: CompositorOptions);
44
+ /**
45
+ * Loads a video source into the compositor's source pool.
46
+ * @param source - Video source (URL, File, Blob, or MediaStream)
47
+ * @param options - Optional loading configuration
48
+ * @returns The loaded compositor source
49
+ */
50
+ loadSource(source: MediaSource, options?: CompositorSourceOptions): Promise<CompositorSource>;
51
+ /**
52
+ * Loads an image source into the compositor's source pool.
53
+ * @param source - Image source (URL, File, or Blob)
54
+ * @returns The loaded compositor source
55
+ */
56
+ loadImage(source: string | Blob | File): Promise<CompositorSource>;
57
+ /**
58
+ * Loads an audio source into the compositor's source pool.
59
+ * @param source - Audio source (URL, File, Blob, or MediaStream)
60
+ * @param options - Optional loading configuration
61
+ * @returns The loaded compositor source
62
+ */
63
+ loadAudio(source: MediaSource, options?: CompositorSourceOptions): Promise<CompositorSource>;
64
+ /**
65
+ * Unloads a source from the compositor's source pool.
66
+ * @param id - The source ID to unload
67
+ * @returns True if the source was found and unloaded
68
+ */
69
+ unloadSource(id: string): boolean;
70
+ /**
71
+ * Gets a source by ID from the source pool.
72
+ * @param id - The source ID
73
+ * @returns The source if found, undefined otherwise
74
+ */
75
+ getSource(id: string): CompositorSource | undefined;
76
+ /**
77
+ * Gets all sources currently loaded in the source pool.
78
+ * @returns Array of all loaded sources
79
+ */
80
+ getAllSources(): CompositorSource[];
81
+ /**
82
+ * Renders a composition frame to the canvas.
83
+ * Fetches all layer frames in parallel before drawing to prevent flicker.
84
+ * @param frame - The composition frame to render
85
+ * @returns True if rendering succeeded
86
+ */
87
+ render(frame: CompositionFrame): Promise<boolean>;
88
+ private renderLayer;
89
+ /**
90
+ * Clears the canvas with the background color.
91
+ */
92
+ clear(): void;
93
+ /**
94
+ * Configures the preview playback with a composition callback.
95
+ * Must be called before play() or seek().
96
+ * @param options - Preview configuration including duration and composition callback
97
+ */
98
+ preview(options: PreviewOptions): void;
99
+ /**
100
+ * Starts playback of the preview composition.
101
+ * @throws Error if preview() has not been called first
102
+ */
103
+ play(): Promise<void>;
104
+ /**
105
+ * Pauses playback of the preview composition.
106
+ */
107
+ pause(): void;
108
+ /**
109
+ * Seeks to a specific time in the preview composition.
110
+ * @param time - Time in seconds to seek to
111
+ */
112
+ seek(time: number): Promise<void>;
113
+ private startRenderLoop;
114
+ private stopRenderLoop;
115
+ /**
116
+ * Exports a single frame at the specified time as an image blob.
117
+ * @param time - Time in seconds to export
118
+ * @param options - Export options (format, quality)
119
+ * @returns Image blob or null if export failed
120
+ */
121
+ exportFrame(time: number, options?: FrameExportOptions): Promise<Blob | null>;
122
+ /** Current playback time in seconds. */
123
+ get currentTime(): number;
124
+ /** Total duration of the preview composition in seconds. */
125
+ get duration(): number;
126
+ /** Whether the compositor is currently playing. */
127
+ get playing(): boolean;
128
+ /** Whether the compositor is currently paused. */
129
+ get paused(): boolean;
130
+ /** Whether the compositor is currently seeking. */
131
+ get seeking(): boolean;
132
+ /**
133
+ * Gets the current canvas width.
134
+ * @returns Width in pixels
135
+ */
136
+ getWidth(): number;
137
+ /**
138
+ * Gets the current canvas height.
139
+ * @returns Height in pixels
140
+ */
141
+ getHeight(): number;
142
+ /**
143
+ * Resizes the compositor canvas without disposing loaded sources.
144
+ * @param width - New width in pixels
145
+ * @param height - New height in pixels
146
+ */
147
+ resize(width: number, height: number): void;
148
+ /**
149
+ * Subscribes to a compositor event.
150
+ * @param event - Event name to listen for
151
+ * @param listener - Callback function
152
+ * @returns Unsubscribe function
153
+ */
154
+ on<K extends keyof CompositorEventMap>(event: K, listener: CompositorEventListener<K>): () => void;
155
+ /**
156
+ * Subscribes to a compositor event for a single invocation.
157
+ * @param event - Event name to listen for
158
+ * @param listener - Callback function
159
+ * @returns Unsubscribe function
160
+ */
161
+ once<K extends keyof CompositorEventMap>(event: K, listener: CompositorEventListener<K>): () => void;
162
+ /**
163
+ * Unsubscribes from a compositor event.
164
+ * @param event - Event name to unsubscribe from
165
+ * @param listener - Optional specific listener to remove
166
+ */
167
+ off<K extends keyof CompositorEventMap>(event: K, listener?: CompositorEventListener<K>): void;
168
+ private checkDisposed;
169
+ /**
170
+ * Disposes the compositor and releases all resources.
171
+ * After disposal, the compositor cannot be used.
172
+ */
173
+ dispose(): void;
174
+ }
175
+ //# 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,uBAAuB,EACvB,kBAAkB,EAElB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,gB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C,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;AAuIrF,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;IA8ChG,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=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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,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,E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