@designcombo/video 0.1.11 → 0.1.13

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.
@@ -1,4 +1,4 @@
1
- import { F as Ie, u as Ee, l as se, M as v, G as De, v as Oe, S as Fe, x as ae, E as u, e as D, y as S, z as Le, H as O, I as b, R as F, J as ne, K as He, t as m, b as f, i as B, w as L, L as K, N as We, c as Y, B as y, j as U, O as ze, Q as C, k as M, V as w, W as Ve, a as Ne, X as ie, Y as oe, Z as le, _ as ue, C as P, $ as je, a0 as A, a1 as J, D as H, a2 as $e, a3 as qe, P as Ke, d as Ye, T as X, a4 as Q, a5 as Je, a6 as Xe, a7 as Qe } from "./index-DWKp2xEE.js";
1
+ import { F as Ie, u as Ee, l as se, M as v, G as De, v as Oe, S as Fe, x as ae, E as u, e as D, y as S, z as Le, H as O, I as b, R as F, J as ne, K as He, t as m, b as f, i as B, w as L, L as K, N as We, c as Y, B as y, j as U, O as ze, Q as C, k as M, V as w, W as Ve, a as Ne, X as ie, Y as oe, Z as le, _ as ue, C as P, $ as je, a0 as A, a1 as J, D as H, a2 as $e, a3 as qe, P as Ke, d as Ye, T as X, a4 as Q, a5 as Je, a6 as Xe, a7 as Qe } from "./index-DSnnNrXJ.js";
2
2
  import { B as de, c as Ze } from "./colorToUniform-C2jGzNe1.js";
3
3
  var et = `in vec2 vMaskCoord;
4
4
  in vec2 vTextureCoord;
@@ -1,6 +1,6 @@
1
- import { S as G, E as d, B as v, w as m, D as S, L as j, v as ve, s as U, t as b, a8 as Be, k as K, a9 as Ae, b as p, V as L, j as B, i as A, l as F, M as $, aa as z, ab as Ne, ac as ye, ad as Y, ae as Ce, A as De, R as Ie, e as T } from "./index-DWKp2xEE.js";
1
+ import { S as G, E as d, B as v, w as m, D as S, L as j, v as ve, s as U, t as b, a8 as Be, k as K, a9 as Ae, b as p, V as L, j as B, i as A, l as F, M as $, aa as z, ab as Ne, ac as ye, ad as Y, ae as Ce, A as De, R as Ie, e as T } from "./index-DSnnNrXJ.js";
2
2
  import { b as q } from "./colorToUniform-C2jGzNe1.js";
3
- import { e as Ge, G as Ue, c as Fe, b as Oe, U as Pe, R as Me, B as Z, d as N, f as Le, S as He, a as we } from "./SharedSystems-D0OoaJby.js";
3
+ import { e as Ge, G as Ue, c as Fe, b as Oe, U as Pe, R as Me, B as Z, d as N, f as Le, S as He, a as we } from "./SharedSystems-CG7UWab9.js";
4
4
  class Q {
5
5
  constructor() {
6
6
  this._tempState = G.for2d(), this._didUploadHash = {};
@@ -1,6 +1,6 @@
1
- import { S as E, g as A, E as p, f as ae, D as S, b as C, B as T, c as ue, d as L, h as M, w as v, i as x, j as ce, k as de, l as k, m as w, M as D, n as H, o as he, p as pe, q as z, s as F, t as R, A as le, R as fe, e as B } from "./index-DWKp2xEE.js";
1
+ import { S as E, g as A, E as p, f as ae, D as S, b as C, B as T, c as ue, d as L, h as M, w as v, i as x, j as ce, k as de, l as k, m as w, M as D, n as H, o as he, p as pe, q as z, s as F, t as R, A as le, R as fe, e as B } from "./index-DSnnNrXJ.js";
2
2
  import { l as ge, a as me } from "./colorToUniform-C2jGzNe1.js";
3
- import { c as _e, u as be, U as xe, B as ye, G as Ge, e as Se, R as Be, t as Pe, S as Te, a as Ce } from "./SharedSystems-D0OoaJby.js";
3
+ import { c as _e, u as be, U as xe, B as ye, G as Ge, e as Se, R as Be, t as Pe, S as Te, a as Ce } from "./SharedSystems-CG7UWab9.js";
4
4
  const y = E.for2d();
5
5
  class O {
6
6
  start(e, t, r) {
@@ -1,5 +1,5 @@
1
- import { T as M, U as Z, P as m, r as te, E as y, a as ie, w as g, e as P, C as V } from "./index-DWKp2xEE.js";
2
- import "./webworkerAll-CZg7nv2I.js";
1
+ import { T as M, U as Z, P as m, r as te, E as y, a as ie, w as g, e as P, C as V } from "./index-DSnnNrXJ.js";
2
+ import "./webworkerAll-CmuBF-4y.js";
3
3
  class q {
4
4
  constructor(e) {
5
5
  this._lastTransform = "", this._observer = null, this._tickerAttached = !1, this.updateTranslation = () => {
@@ -1,7 +1,7 @@
1
1
  import { BaseClip } from './base-clip';
2
2
  import { IClip, IPlaybackCapable } from './iclip';
3
- import { AudioClipJSON } from '../json-serialization';
4
- interface IAudioClipOpts {
3
+ import { AudioJSON } from '../json-serialization';
4
+ interface IAudioOpts {
5
5
  loop?: boolean;
6
6
  volume?: number;
7
7
  }
@@ -10,17 +10,17 @@ interface IAudioClipOpts {
10
10
  *
11
11
  * @example
12
12
  * // Load audio clip asynchronously
13
- * const audioClip = await AudioClip.fromUrl('path/to/audio.mp3', {
13
+ * const audioClip = await Audio.fromUrl('path/to/audio.mp3', {
14
14
  * loop: true,
15
15
  * });
16
16
  *
17
17
  * @example
18
18
  * // Traditional approach (for advanced use)
19
- * new AudioClip((await fetch('<mp3 url>')).body, {
19
+ * new Audio((await fetch('<mp3 url>')).body, {
20
20
  * loop: true,
21
21
  * }),
22
22
  */
23
- export declare class AudioClip extends BaseClip implements IPlaybackCapable {
23
+ export declare class Audio extends BaseClip implements IPlaybackCapable {
24
24
  readonly type = "Audio";
25
25
  static ctx: AudioContext | null;
26
26
  ready: IClip['ready'];
@@ -55,32 +55,32 @@ export declare class AudioClip extends BaseClip implements IPlaybackCapable {
55
55
  * @returns Promise that resolves to an audio clip
56
56
  *
57
57
  * @example
58
- * const audioClip = await AudioClip.fromUrl('path/to/audio.mp3', {
58
+ * const audioClip = await Audio.fromUrl('path/to/audio.mp3', {
59
59
  * loop: true,
60
60
  * volume: 0.8,
61
61
  * });
62
62
  */
63
- static fromUrl(url: string, opts?: IAudioClipOpts): Promise<AudioClip>;
63
+ static fromUrl(url: string, opts?: IAudioOpts): Promise<Audio>;
64
64
  /**
65
- * Create an AudioClip instance from a JSON object (fabric.js pattern)
65
+ * Create an Audio instance from a JSON object (fabric.js pattern)
66
66
  * @param json The JSON object representing the clip
67
- * @returns Promise that resolves to an AudioClip instance
67
+ * @returns Promise that resolves to an Audio instance
68
68
  */
69
- static fromObject(json: AudioClipJSON): Promise<AudioClip>;
69
+ static fromObject(json: AudioJSON): Promise<Audio>;
70
70
  /**
71
71
  *
72
72
  * @param dataSource Audio file stream
73
73
  * @param opts Audio configuration, controls volume and whether to loop
74
74
  */
75
- constructor(dataSource: ReadableStream<Uint8Array> | Float32Array[], opts?: IAudioClipOpts, src?: string);
75
+ constructor(dataSource: ReadableStream<Uint8Array> | Float32Array[], opts?: IAudioOpts, src?: string);
76
76
  private init;
77
77
  /**
78
- * Intercept data returned by {@link AudioClip.tick} method for secondary processing of audio data
78
+ * Intercept data returned by {@link Audio.tick} method for secondary processing of audio data
79
79
  * @param time Time when tick was called
80
80
  * @param tickRet Data returned by tick
81
81
  *
82
82
  */
83
- tickInterceptor: <T extends Awaited<ReturnType<AudioClip['tick']>>>(time: number, tickRet: T) => Promise<T>;
83
+ tickInterceptor: <T extends Awaited<ReturnType<Audio['tick']>>>(time: number, tickRet: T) => Promise<T>;
84
84
  private timestamp;
85
85
  private frameOffset;
86
86
  /**
@@ -106,8 +106,8 @@ export declare class AudioClip extends BaseClip implements IPlaybackCapable {
106
106
  * Destroy instance and release resources
107
107
  */
108
108
  destroy(): void;
109
- toJSON(main?: boolean): AudioClipJSON;
110
- static concatAudioClip: typeof concatAudioClip;
109
+ toJSON(main?: boolean): AudioJSON;
110
+ static concatAudio: typeof concatAudioClip;
111
111
  /**
112
112
  * Create HTMLAudioElement for playback
113
113
  */
@@ -124,5 +124,5 @@ export declare class AudioClip extends BaseClip implements IPlaybackCapable {
124
124
  /**
125
125
  * Concatenate multiple AudioClips
126
126
  */
127
- export declare function concatAudioClip(clips: AudioClip[], opts?: IAudioClipOpts): Promise<AudioClip>;
127
+ export declare function concatAudioClip(clips: Audio[], opts?: IAudioOpts): Promise<Audio>;
128
128
  export {};
@@ -1,8 +1,8 @@
1
1
  import { BaseClip } from './base-clip';
2
2
  import { IClip } from './iclip';
3
- import { CaptionClipJSON } from '../json-serialization';
3
+ import { CaptionJSON } from '../json-serialization';
4
4
  import { Application, Texture } from 'pixi.js';
5
- export interface ICaptionClipOpts {
5
+ export interface ICaptionOpts {
6
6
  /**
7
7
  * Font size in pixels
8
8
  * @default 30
@@ -173,7 +173,7 @@ export interface ICaptionClipOpts {
173
173
  * captionClip.display.from = 0;
174
174
  * captionClip.duration = 3e6; // 3 seconds
175
175
  */
176
- export declare class CaptionClip extends BaseClip implements IClip {
176
+ export declare class Caption extends BaseClip implements IClip {
177
177
  readonly type = "Caption";
178
178
  ready: IClip['ready'];
179
179
  private _meta;
@@ -255,11 +255,11 @@ export declare class CaptionClip extends BaseClip implements IClip {
255
255
  private externalRenderer;
256
256
  private pixiApp;
257
257
  private originalOpts;
258
- constructor(text: string, opts?: ICaptionClipOpts, renderer?: Application['renderer']);
258
+ constructor(text: string, opts?: ICaptionOpts, renderer?: Application['renderer']);
259
259
  /**
260
260
  * Update text styling options and refresh the caption rendering
261
261
  */
262
- updateStyle(opts: Partial<ICaptionClipOpts>): Promise<void>;
262
+ updateStyle(opts: Partial<ICaptionOpts>): Promise<void>;
263
263
  private refreshCaptions;
264
264
  private lastLoggedTime;
265
265
  updateState(currentTime: number): void;
@@ -294,11 +294,11 @@ export declare class CaptionClip extends BaseClip implements IClip {
294
294
  removeEffect(effectId: string): void;
295
295
  clone(): Promise<this>;
296
296
  destroy(): void;
297
- toJSON(main?: boolean): CaptionClipJSON;
297
+ toJSON(main?: boolean): CaptionJSON;
298
298
  /**
299
- * Create a CaptionClip instance from a JSON object (fabric.js pattern)
299
+ * Create a Caption instance from a JSON object (fabric.js pattern)
300
300
  * @param json The JSON object representing the clip
301
- * @returns Promise that resolves to a CaptionClip instance
301
+ * @returns Promise that resolves to a Caption instance
302
302
  */
303
- static fromObject(json: CaptionClipJSON): Promise<CaptionClip>;
303
+ static fromObject(json: CaptionJSON): Promise<Caption>;
304
304
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseClip } from './base-clip';
2
2
  import { IClip } from './iclip';
3
3
  import { EffectKey } from '../effect/glsl/gl-effect';
4
- export declare class EffectClip extends BaseClip {
4
+ export declare class Effect extends BaseClip {
5
5
  readonly type = "Effect";
6
6
  ready: IClip['ready'];
7
7
  private _meta;
@@ -31,7 +31,7 @@ export declare class EffectClip extends BaseClip {
31
31
  split(_time: number): Promise<[this, this]>;
32
32
  toJSON(main?: boolean): any;
33
33
  /**
34
- * Create an EffectClip instance from a JSON object
34
+ * Create an Effect instance from a JSON object
35
35
  */
36
- static fromObject(json: any): Promise<EffectClip>;
36
+ static fromObject(json: any): Promise<Effect>;
37
37
  }
@@ -1,7 +1,7 @@
1
1
  import { Texture } from 'pixi.js';
2
2
  import { BaseClip } from './base-clip';
3
3
  import { IClip } from './iclip';
4
- import { ClipJSON, ImageClipJSON } from '../json-serialization';
4
+ import { ClipJSON, ImageJSON } from '../json-serialization';
5
5
  type AnimateImgType = 'avif' | 'webp' | 'png' | 'gif';
6
6
  /**
7
7
  * Image clip supporting animated images
@@ -10,14 +10,14 @@ type AnimateImgType = 'avif' | 'webp' | 'png' | 'gif';
10
10
  *
11
11
  * @example
12
12
  * // Load from URL using PixiJS Assets (optimized for Studio)
13
- * const imgClip = await ImageClip.fromUrl('path/to/image.png');
13
+ * const imgClip = await Image.fromUrl('path/to/image.png');
14
14
  *
15
15
  * @example
16
16
  * // Traditional approach (for Compositor/export)
17
- * new ImageClip((await fetch('<img url>')).body);
17
+ * new Image((await fetch('<img url>')).body);
18
18
  *
19
19
  * @example
20
- * new ImageClip(
20
+ * new Image(
21
21
  * await renderTxt2ImgBitmap(
22
22
  * 'Watermark',
23
23
  * `font-size:40px; color: white; text-shadow: 2px 2px 6px red;`,
@@ -25,7 +25,7 @@ type AnimateImgType = 'avif' | 'webp' | 'png' | 'gif';
25
25
  * )
26
26
  *
27
27
  */
28
- export declare class ImageClip extends BaseClip implements IClip {
28
+ export declare class Image extends BaseClip implements IClip {
29
29
  readonly type = "Image";
30
30
  ready: IClip['ready'];
31
31
  private _meta;
@@ -63,12 +63,12 @@ export declare class ImageClip extends BaseClip implements IClip {
63
63
  *
64
64
  * @param url Image URL
65
65
  * @param src Optional source identifier for serialization
66
- * @returns Promise that resolves to an ImageClip instance
66
+ * @returns Promise that resolves to an Image instance
67
67
  *
68
68
  * @example
69
- * const imgClip = await ImageClip.fromUrl('path/to/image.png');
69
+ * const imgClip = await Image.fromUrl('path/to/image.png');
70
70
  */
71
- static fromUrl(url: string, src?: string): Promise<ImageClip>;
71
+ static fromUrl(url: string, src?: string): Promise<Image>;
72
72
  /**
73
73
  * Get the PixiJS Texture (if available)
74
74
  * This is used for optimized rendering in Studio
@@ -84,7 +84,7 @@ export declare class ImageClip extends BaseClip implements IClip {
84
84
  stream: ReadableStream;
85
85
  }, src?: string);
86
86
  private initAnimateImg;
87
- tickInterceptor: <T extends Awaited<ReturnType<ImageClip['tick']>>>(time: number, tickRet: T) => Promise<T>;
87
+ tickInterceptor: <T extends Awaited<ReturnType<Image['tick']>>>(time: number, tickRet: T) => Promise<T>;
88
88
  tick(time: number): Promise<{
89
89
  video: ImageBitmap | VideoFrame;
90
90
  state: 'success';
@@ -104,12 +104,12 @@ export declare class ImageClip extends BaseClip implements IClip {
104
104
  }>): void;
105
105
  removeEffect(effectId: string): void;
106
106
  destroy(): void;
107
- toJSON(main?: boolean): ImageClipJSON;
107
+ toJSON(main?: boolean): ImageJSON;
108
108
  /**
109
- * Create an ImageClip instance from a JSON object (fabric.js pattern)
109
+ * Create an Image instance from a JSON object (fabric.js pattern)
110
110
  * @param json The JSON object representing the clip
111
- * @returns Promise that resolves to an ImageClip instance
111
+ * @returns Promise that resolves to an Image instance
112
112
  */
113
- static fromObject(json: ClipJSON): Promise<ImageClip>;
113
+ static fromObject(json: ClipJSON): Promise<Image>;
114
114
  }
115
115
  export {};
@@ -3,9 +3,12 @@ export * from './caption-clip';
3
3
  export * from './iclip';
4
4
  export * from './image-clip';
5
5
  export * from './video-clip';
6
- export { VideoClip } from './video-clip';
6
+ export { Video } from './video-clip';
7
7
  export type { IMP4ClipOpts } from './video-clip';
8
8
  export * from './text-clip';
9
9
  export * from './effect-clip';
10
+ export { Effect } from './effect-clip';
10
11
  export * from './placeholder-clip';
12
+ export { Placeholder } from './placeholder-clip';
11
13
  export * from './transition-clip';
14
+ export { Transition } from './transition-clip';
@@ -1,6 +1,6 @@
1
1
  import { BaseClip } from './base-clip';
2
2
  import { IClipMeta } from './iclip';
3
- export declare class PlaceholderClip extends BaseClip {
3
+ export declare class Placeholder extends BaseClip {
4
4
  type: string;
5
5
  meta: IClipMeta;
6
6
  constructor(src: string, meta?: Partial<IClipMeta>, type?: string);
@@ -1,8 +1,8 @@
1
1
  import { Application, Texture } from 'pixi.js';
2
2
  import { BaseClip } from './base-clip';
3
3
  import { IClip } from './iclip';
4
- import { TextClipJSON } from '../json-serialization';
5
- export interface ITextClipOpts {
4
+ import { TextJSON } from '../json-serialization';
5
+ export interface ITextOpts {
6
6
  /**
7
7
  * Font size in pixels
8
8
  * @default 40
@@ -116,7 +116,7 @@ export interface ITextClipOpts {
116
116
  * Text clip using PixiJS Text for rendering
117
117
  *
118
118
  * @example
119
- * const textClip = new TextClip('Hello World', {
119
+ * const textClip = new Text('Hello World', {
120
120
  * fontSize: 48,
121
121
  * fill: '#ffffff',
122
122
  * stroke: '#000000',
@@ -130,7 +130,7 @@ export interface ITextClipOpts {
130
130
  * });
131
131
  * textClip.duration = 5e6; // 5 seconds
132
132
  */
133
- export declare class TextClip extends BaseClip {
133
+ export declare class Text extends BaseClip {
134
134
  readonly type = "Text";
135
135
  ready: IClip['ready'];
136
136
  private _meta;
@@ -160,7 +160,7 @@ export declare class TextClip extends BaseClip {
160
160
  * Provides direct access to styling properties
161
161
  */
162
162
  get style(): any;
163
- set style(opts: Partial<ITextClipOpts>);
163
+ set style(opts: Partial<ITextOpts>);
164
164
  /**
165
165
  * Text alignment proxy for compatibility with UI
166
166
  */
@@ -196,7 +196,7 @@ export declare class TextClip extends BaseClip {
196
196
  startTime: number;
197
197
  duration: number;
198
198
  }>;
199
- constructor(text: string, opts?: ITextClipOpts, renderer?: Application['renderer']);
199
+ constructor(text: string, opts?: ITextOpts, renderer?: Application['renderer']);
200
200
  /**
201
201
  * Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
202
202
  * This is an optimization for Studio preview
@@ -237,24 +237,24 @@ export declare class TextClip extends BaseClip {
237
237
  * Update text styling options and refresh the texture
238
238
  * This is used for dynamic updates like resizing with text reflow
239
239
  */
240
- updateStyle(opts: Partial<ITextClipOpts>): Promise<void>;
240
+ updateStyle(opts: Partial<ITextOpts>): Promise<void>;
241
241
  /**
242
242
  * Refresh the internal Pixi Text and RenderTexture
243
243
  * Calculates dimensions based on text bounds and wrapping options
244
244
  */
245
245
  private refreshText;
246
246
  /**
247
- * Helper to create PixiJS TextStyle options from TextClip options
247
+ * Helper to create PixiJS TextStyle options from Text options
248
248
  */
249
249
  private createStyleFromOpts;
250
250
  destroy(): void;
251
- toJSON(main?: boolean): TextClipJSON;
251
+ toJSON(main?: boolean): TextJSON;
252
252
  /**
253
- * Create a TextClip instance from a JSON object (fabric.js pattern)
253
+ * Create a Text instance from a JSON object (fabric.js pattern)
254
254
  * @param json The JSON object representing the clip
255
- * @returns Promise that resolves to a TextClip instance
255
+ * @returns Promise that resolves to a Text instance
256
256
  */
257
- static fromObject(json: TextClipJSON): Promise<TextClip>;
257
+ static fromObject(json: TextJSON): Promise<Text>;
258
258
  /**
259
259
  * Override handle visibility for text clips
260
260
  * Text clips should only show: mr (mid-right), mb (mid-bottom), br (bottom-right), and rot (rotation)
@@ -1,7 +1,7 @@
1
1
  import { BaseClip } from './base-clip';
2
2
  import { IClip } from './iclip';
3
3
  import { TransitionKey } from '../transition/glsl/gl-transition';
4
- export declare class TransitionClip extends BaseClip {
4
+ export declare class Transition extends BaseClip {
5
5
  readonly type = "Transition";
6
6
  ready: IClip['ready'];
7
7
  private _meta;
@@ -39,7 +39,7 @@ export declare class TransitionClip extends BaseClip {
39
39
  split(_time: number): Promise<[this, this]>;
40
40
  toJSON(main?: boolean): any;
41
41
  /**
42
- * Create a TransitionClip instance from a JSON object
42
+ * Create a Transition instance from a JSON object
43
43
  */
44
- static fromObject(json: any): Promise<TransitionClip>;
44
+ static fromObject(json: any): Promise<Transition>;
45
45
  }
@@ -2,7 +2,7 @@ import { MP4Sample } from 'wrapbox';
2
2
  import { file } from 'opfs-tools';
3
3
  import { BaseClip } from './base-clip';
4
4
  import { IClip, IPlaybackCapable } from './iclip';
5
- import { VideoClipJSON } from '../json-serialization';
5
+ import { VideoJSON } from '../json-serialization';
6
6
  type OPFSToolFile = ReturnType<typeof file>;
7
7
  type MPClipCloneArgs = Awaited<ReturnType<typeof mp4FileToSamples>> & {
8
8
  localFile: OPFSToolFile;
@@ -25,14 +25,19 @@ type ExtMP4Sample = Omit<MP4Sample, 'data'> & {
25
25
  deleted?: boolean;
26
26
  data: null | Uint8Array;
27
27
  };
28
+ type ThumbnailOpts = {
29
+ start: number;
30
+ end: number;
31
+ step: number;
32
+ };
28
33
  /**
29
- * Video clip, parses MP4 files, uses {@link VideoClip.tick} to decode image frames at specified time on demand
34
+ * Video clip, parses MP4 files, uses {@link Video.tick} to decode image frames at specified time on demand
30
35
  *
31
36
  * Can be used to implement video frame extraction, thumbnail generation, video editing and other functions
32
37
  *
33
38
  * @example
34
39
  * // Load video clip asynchronously
35
- * const videoClip = await VideoClip.fromUrl('clip.mp4', {
40
+ * const videoClip = await Video.fromUrl('clip.mp4', {
36
41
  * x: 0,
37
42
  * y: 0,
38
43
  * width: 1920,
@@ -48,7 +53,7 @@ type ExtMP4Sample = Omit<MP4Sample, 'data'> & {
48
53
  * });
49
54
  *
50
55
  */
51
- export declare class VideoClip extends BaseClip implements IPlaybackCapable {
56
+ export declare class Video extends BaseClip implements IPlaybackCapable {
52
57
  readonly type = "Video";
53
58
  private insId;
54
59
  private logger;
@@ -104,7 +109,7 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
104
109
  * @returns Promise that resolves to a video clip
105
110
  *
106
111
  * @example
107
- * const videoClip = await VideoClip.fromUrl('clip.mp4', {
112
+ * const videoClip = await Video.fromUrl('clip.mp4', {
108
113
  * x: 0,
109
114
  * y: 0,
110
115
  * width: 1920,
@@ -116,15 +121,15 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
116
121
  y?: number;
117
122
  width?: number;
118
123
  height?: number;
119
- }): Promise<VideoClip>;
124
+ }): Promise<Video>;
120
125
  constructor(source: OPFSToolFile | ReadableStream<Uint8Array> | MPClipCloneArgs, opts?: IMP4ClipOpts, src?: string);
121
126
  /**
122
- * Intercept data returned by {@link VideoClip.tick} method for secondary processing of image and audio data
127
+ * Intercept data returned by {@link Video.tick} method for secondary processing of image and audio data
123
128
  * @param time Time when tick was called
124
129
  * @param tickRet Data returned by tick
125
130
  *
126
131
  * */
127
- tickInterceptor: <T extends Awaited<ReturnType<VideoClip['tick']>>>(time: number, tickRet: T) => Promise<T>;
132
+ tickInterceptor: <T extends Awaited<ReturnType<Video['tick']>>>(time: number, tickRet: T) => Promise<T>;
128
133
  /**
129
134
  * Get image frame and audio data at specified time
130
135
  * @param time Time in microseconds
@@ -134,6 +139,19 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
134
139
  audio: Float32Array[];
135
140
  state: 'success' | 'done';
136
141
  }>;
142
+ private thumbAborter;
143
+ private thumbFinder;
144
+ /**
145
+ * Generate thumbnails, default generates one 100px width thumbnail per keyframe.
146
+ *
147
+ * @param imgWidth Thumbnail width, default 100
148
+ * @param opts Partial<ThumbnailOpts>
149
+ * @returns Promise<Array<{ ts: number; img: Blob }>>
150
+ */
151
+ thumbnails(imgWidth?: number, opts?: Partial<ThumbnailOpts>): Promise<Array<{
152
+ ts: number;
153
+ img: Blob;
154
+ }>>;
137
155
  split(time: number): Promise<[this, this]>;
138
156
  addEffect(effect: {
139
157
  id: string;
@@ -149,18 +167,22 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
149
167
  removeEffect(effectId: string): void;
150
168
  clone(): Promise<this>;
151
169
  /**
152
- * Split VideoClip into VideoClips containing only video track and audio track
170
+ * Split Video into VideoClips containing only video track and audio track
153
171
  * @returns VideoClip[]
154
172
  */
155
- splitTrack(): Promise<VideoClip[]>;
173
+ splitTrack(): Promise<Video[]>;
174
+ /**
175
+ * Clean up thumbnail generation resources
176
+ */
177
+ cleanupThumbnails: () => Promise<void>;
156
178
  destroy(): void;
157
- toJSON(main?: boolean): VideoClipJSON;
179
+ toJSON(main?: boolean): VideoJSON;
158
180
  /**
159
- * Create a VideoClip instance from a JSON object (fabric.js pattern)
181
+ * Create a Video instance from a JSON object (fabric.js pattern)
160
182
  * @param json The JSON object representing the clip
161
- * @returns Promise that resolves to a VideoClip instance
183
+ * @returns Promise that resolves to a Video instance
162
184
  */
163
- static fromObject(json: VideoClipJSON): Promise<VideoClip>;
185
+ static fromObject(json: VideoJSON): Promise<Video>;
164
186
  /**
165
187
  * Create HTMLVideoElement for playback
166
188
  */
@@ -25,10 +25,10 @@ export interface ICompositorOpts {
25
25
  * Video compositor that can add multiple {@link OffscreenSprite} instances,
26
26
  * @example
27
27
  * const spr1 = new OffscreenSprite(
28
- * new VideoClip((await fetch('<mp4 url>')).body),
28
+ * new Video((await fetch('<mp4 url>')).body),
29
29
  * );
30
30
  * const spr2 = new OffscreenSprite(
31
- * await AudioClip.fromUrl('<audio url>'),
31
+ * await Audio.fromUrl('<audio url>'),
32
32
  * );
33
33
  * const com = new Compositor({ width: 1280, height: 720, });
34
34