@designcombo/video 0.1.10 → 0.1.12
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/{SharedSystems-DGjB21V8.js → SharedSystems-0YB9sQZp.js} +1 -1
- package/dist/{WebGLRenderer-CTO5yi7Z.js → WebGLRenderer-D0QN9_76.js} +2 -2
- package/dist/{WebGPURenderer-CCSxFbS6.js → WebGPURenderer-BT-NkEIk.js} +2 -2
- package/dist/{browserAll-BmqWP9Wx.js → browserAll-C1airNhp.js} +2 -2
- package/dist/clips/audio-clip.d.ts +16 -17
- package/dist/clips/base-clip.d.ts +19 -0
- package/dist/clips/caption-clip.d.ts +50 -9
- package/dist/clips/effect-clip.d.ts +3 -3
- package/dist/clips/iclip.d.ts +16 -2
- package/dist/clips/image-clip.d.ts +13 -35
- package/dist/clips/index.d.ts +5 -1
- package/dist/clips/placeholder-clip.d.ts +15 -0
- package/dist/clips/text-clip.d.ts +16 -12
- package/dist/clips/transition-clip.d.ts +3 -3
- package/dist/clips/video-clip.d.ts +17 -27
- package/dist/compositor.d.ts +7 -11
- package/dist/event-emitter.d.ts +10 -2
- package/dist/{index-DBEPaJbQ.js → index-Bg9KGlQ_.js} +19030 -14882
- package/dist/index.d.ts +4 -4
- package/dist/index.es.js +25 -23
- package/dist/index.umd.js +203 -201
- package/dist/json-serialization.d.ts +17 -11
- package/dist/mp4-utils/index.d.ts +1 -1
- package/dist/mp4-utils/mp4box-utils.d.ts +15 -7
- package/dist/mp4-utils/sample-transform.d.ts +20 -17
- package/dist/sprite/base-sprite.d.ts +1 -2
- package/dist/studio/selection-manager.d.ts +1 -1
- package/dist/studio/timeline-model.d.ts +26 -9
- package/dist/studio.d.ts +26 -13
- package/dist/utils/asset-manager.d.ts +6 -0
- package/dist/utils/dom.d.ts +3 -3
- package/dist/utils/log.d.ts +27 -0
- package/dist/utils/stream-utils.d.ts +9 -0
- package/dist/utils/video.d.ts +0 -2
- package/dist/utils/worker-timer.d.ts +1 -0
- package/dist/{webworkerAll-DKfEYGh2.js → webworkerAll-v-K8jfl0.js} +1 -1
- package/package.json +5 -5
- package/dist/internal-utils/event-tool.d.ts +0 -50
- package/dist/internal-utils/index.d.ts +0 -14
- package/dist/internal-utils/log.d.ts +0 -34
- package/dist/internal-utils/meta-box.d.ts +0 -1
- package/dist/internal-utils/recodemux.d.ts +0 -65
- package/dist/internal-utils/stream-utils.d.ts +0 -43
- package/dist/internal-utils/worker-timer.d.ts +0 -8
|
@@ -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-
|
|
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-Bg9KGlQ_.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-
|
|
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-Bg9KGlQ_.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-
|
|
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-0YB9sQZp.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-
|
|
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-Bg9KGlQ_.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-
|
|
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-0YB9sQZp.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-
|
|
2
|
-
import "./webworkerAll-
|
|
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-Bg9KGlQ_.js";
|
|
2
|
+
import "./webworkerAll-v-K8jfl0.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 {
|
|
4
|
-
interface
|
|
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
|
|
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
|
|
19
|
+
* new Audio((await fetch('<mp3 url>')).body, {
|
|
20
20
|
* loop: true,
|
|
21
21
|
* }),
|
|
22
22
|
*/
|
|
23
|
-
export declare class
|
|
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,33 +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
|
|
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?:
|
|
63
|
+
static fromUrl(url: string, opts?: IAudioOpts): Promise<Audio>;
|
|
64
64
|
/**
|
|
65
|
-
* Create an
|
|
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
|
|
67
|
+
* @returns Promise that resolves to an Audio instance
|
|
68
68
|
*/
|
|
69
|
-
static fromObject(json:
|
|
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?:
|
|
75
|
+
constructor(dataSource: ReadableStream<Uint8Array> | Float32Array[], opts?: IAudioOpts, src?: string);
|
|
76
76
|
private init;
|
|
77
77
|
/**
|
|
78
|
-
* Intercept data returned by {@link
|
|
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
|
-
* @see [Remove video green screen background](https://webav-tech.github.io/WebAV/demo/3_2-chromakey-video)
|
|
83
82
|
*/
|
|
84
|
-
tickInterceptor: <T extends Awaited<ReturnType<
|
|
83
|
+
tickInterceptor: <T extends Awaited<ReturnType<Audio['tick']>>>(time: number, tickRet: T) => Promise<T>;
|
|
85
84
|
private timestamp;
|
|
86
85
|
private frameOffset;
|
|
87
86
|
/**
|
|
@@ -107,8 +106,8 @@ export declare class AudioClip extends BaseClip implements IPlaybackCapable {
|
|
|
107
106
|
* Destroy instance and release resources
|
|
108
107
|
*/
|
|
109
108
|
destroy(): void;
|
|
110
|
-
toJSON(main?: boolean):
|
|
111
|
-
static
|
|
109
|
+
toJSON(main?: boolean): AudioJSON;
|
|
110
|
+
static concatAudio: typeof concatAudioClip;
|
|
112
111
|
/**
|
|
113
112
|
* Create HTMLAudioElement for playback
|
|
114
113
|
*/
|
|
@@ -125,5 +124,5 @@ export declare class AudioClip extends BaseClip implements IPlaybackCapable {
|
|
|
125
124
|
/**
|
|
126
125
|
* Concatenate multiple AudioClips
|
|
127
126
|
*/
|
|
128
|
-
export declare function concatAudioClip(clips:
|
|
127
|
+
export declare function concatAudioClip(clips: Audio[], opts?: IAudioOpts): Promise<Audio>;
|
|
129
128
|
export {};
|
|
@@ -93,5 +93,24 @@ export declare abstract class BaseClip extends BaseSprite implements IClip {
|
|
|
93
93
|
* Override in subclasses to customize handle visibility (e.g., TextClip)
|
|
94
94
|
*/
|
|
95
95
|
getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
|
|
96
|
+
/**
|
|
97
|
+
* Scale clip to fit within the scene dimensions while maintaining aspect ratio
|
|
98
|
+
* @param sceneWidth Scene width
|
|
99
|
+
* @param sceneHeight Scene height
|
|
100
|
+
*/
|
|
101
|
+
scaleToFit(sceneWidth: number, sceneHeight: number): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Scale clip to fill the scene dimensions while maintaining aspect ratio
|
|
104
|
+
* May crop parts of the clip.
|
|
105
|
+
* @param sceneWidth Scene width
|
|
106
|
+
* @param sceneHeight Scene height
|
|
107
|
+
*/
|
|
108
|
+
scaleToFill(sceneWidth: number, sceneHeight: number): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Center the clip within the scene dimensions
|
|
111
|
+
* @param sceneWidth Scene width
|
|
112
|
+
* @param sceneHeight Scene height
|
|
113
|
+
*/
|
|
114
|
+
centerInScene(sceneWidth: number, sceneHeight: number): void;
|
|
96
115
|
destroy(): void;
|
|
97
116
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseClip } from './base-clip';
|
|
2
2
|
import { IClip } from './iclip';
|
|
3
|
-
import {
|
|
3
|
+
import { CaptionJSON } from '../json-serialization';
|
|
4
4
|
import { Application, Texture } from 'pixi.js';
|
|
5
|
-
export interface
|
|
5
|
+
export interface ICaptionOpts {
|
|
6
6
|
/**
|
|
7
7
|
* Font size in pixels
|
|
8
8
|
* @default 30
|
|
@@ -48,6 +48,7 @@ export interface ICaptionClipOpts {
|
|
|
48
48
|
from: number;
|
|
49
49
|
to: number;
|
|
50
50
|
isKeyWord: boolean;
|
|
51
|
+
paragraphIndex?: number;
|
|
51
52
|
}>;
|
|
52
53
|
colors?: {
|
|
53
54
|
appeared?: string;
|
|
@@ -71,6 +72,7 @@ export interface ICaptionClipOpts {
|
|
|
71
72
|
from: number;
|
|
72
73
|
to: number;
|
|
73
74
|
isKeyWord: boolean;
|
|
75
|
+
paragraphIndex?: number;
|
|
74
76
|
}>;
|
|
75
77
|
/**
|
|
76
78
|
* @deprecated Use caption.colors instead
|
|
@@ -151,6 +153,10 @@ export interface ICaptionClipOpts {
|
|
|
151
153
|
* @default 'none'
|
|
152
154
|
*/
|
|
153
155
|
textCase?: 'none' | 'uppercase' | 'lowercase' | 'title';
|
|
156
|
+
/**
|
|
157
|
+
* Media ID to which the captions were applied
|
|
158
|
+
*/
|
|
159
|
+
mediaId?: string;
|
|
154
160
|
}
|
|
155
161
|
/**
|
|
156
162
|
* Caption clip using Canvas 2D for rendering
|
|
@@ -167,7 +173,7 @@ export interface ICaptionClipOpts {
|
|
|
167
173
|
* captionClip.display.from = 0;
|
|
168
174
|
* captionClip.duration = 3e6; // 3 seconds
|
|
169
175
|
*/
|
|
170
|
-
export declare class
|
|
176
|
+
export declare class Caption extends BaseClip implements IClip {
|
|
171
177
|
readonly type = "Caption";
|
|
172
178
|
ready: IClip['ready'];
|
|
173
179
|
private _meta;
|
|
@@ -182,6 +188,28 @@ export declare class CaptionClip extends BaseClip implements IClip {
|
|
|
182
188
|
text: string;
|
|
183
189
|
get style(): any;
|
|
184
190
|
set style(v: any);
|
|
191
|
+
get fontFamily(): string;
|
|
192
|
+
set fontFamily(v: string);
|
|
193
|
+
get fontUrl(): string;
|
|
194
|
+
set fontUrl(v: string);
|
|
195
|
+
get fontSize(): number;
|
|
196
|
+
set fontSize(v: number);
|
|
197
|
+
get fontWeight(): string;
|
|
198
|
+
set fontWeight(v: string);
|
|
199
|
+
get fontStyle(): string;
|
|
200
|
+
set fontStyle(v: string);
|
|
201
|
+
get fill(): any;
|
|
202
|
+
set fill(v: any);
|
|
203
|
+
get align(): 'left' | 'center' | 'right';
|
|
204
|
+
set align(v: 'left' | 'center' | 'right');
|
|
205
|
+
get stroke(): any;
|
|
206
|
+
set stroke(v: any);
|
|
207
|
+
get strokeWidth(): number;
|
|
208
|
+
set strokeWidth(v: number);
|
|
209
|
+
get dropShadow(): any;
|
|
210
|
+
set dropShadow(v: any);
|
|
211
|
+
get caption(): any;
|
|
212
|
+
set caption(v: any);
|
|
185
213
|
/**
|
|
186
214
|
* Bottom offset from video bottom (hybrid JSON structure)
|
|
187
215
|
*/
|
|
@@ -195,6 +223,11 @@ export declare class CaptionClip extends BaseClip implements IClip {
|
|
|
195
223
|
* Unique identifier for this clip instance
|
|
196
224
|
*/
|
|
197
225
|
id: string;
|
|
226
|
+
/**
|
|
227
|
+
* Media ID of the source clip
|
|
228
|
+
*/
|
|
229
|
+
get mediaId(): string | undefined;
|
|
230
|
+
set mediaId(v: string | undefined);
|
|
198
231
|
/**
|
|
199
232
|
* Array of effects to be applied to this clip
|
|
200
233
|
* Each effect specifies key, startTime, duration, and optional targets
|
|
@@ -205,6 +238,14 @@ export declare class CaptionClip extends BaseClip implements IClip {
|
|
|
205
238
|
startTime: number;
|
|
206
239
|
duration: number;
|
|
207
240
|
}>;
|
|
241
|
+
/**
|
|
242
|
+
* Words getter for the clip
|
|
243
|
+
*/
|
|
244
|
+
get words(): any[];
|
|
245
|
+
/**
|
|
246
|
+
* Words setter that triggers re-render and ensures consistency
|
|
247
|
+
*/
|
|
248
|
+
set words(v: any[]);
|
|
208
249
|
private opts;
|
|
209
250
|
private pixiTextContainer;
|
|
210
251
|
private renderTexture;
|
|
@@ -214,11 +255,11 @@ export declare class CaptionClip extends BaseClip implements IClip {
|
|
|
214
255
|
private externalRenderer;
|
|
215
256
|
private pixiApp;
|
|
216
257
|
private originalOpts;
|
|
217
|
-
constructor(text: string, opts?:
|
|
258
|
+
constructor(text: string, opts?: ICaptionOpts, renderer?: Application['renderer']);
|
|
218
259
|
/**
|
|
219
260
|
* Update text styling options and refresh the caption rendering
|
|
220
261
|
*/
|
|
221
|
-
updateStyle(opts: Partial<
|
|
262
|
+
updateStyle(opts: Partial<ICaptionOpts>): Promise<void>;
|
|
222
263
|
private refreshCaptions;
|
|
223
264
|
private lastLoggedTime;
|
|
224
265
|
updateState(currentTime: number): void;
|
|
@@ -253,11 +294,11 @@ export declare class CaptionClip extends BaseClip implements IClip {
|
|
|
253
294
|
removeEffect(effectId: string): void;
|
|
254
295
|
clone(): Promise<this>;
|
|
255
296
|
destroy(): void;
|
|
256
|
-
toJSON(main?: boolean):
|
|
297
|
+
toJSON(main?: boolean): CaptionJSON;
|
|
257
298
|
/**
|
|
258
|
-
* Create a
|
|
299
|
+
* Create a Caption instance from a JSON object (fabric.js pattern)
|
|
259
300
|
* @param json The JSON object representing the clip
|
|
260
|
-
* @returns Promise that resolves to a
|
|
301
|
+
* @returns Promise that resolves to a Caption instance
|
|
261
302
|
*/
|
|
262
|
-
static fromObject(json:
|
|
303
|
+
static fromObject(json: CaptionJSON): Promise<Caption>;
|
|
263
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
|
|
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
|
|
34
|
+
* Create an Effect instance from a JSON object
|
|
35
35
|
*/
|
|
36
|
-
static fromObject(json: any): Promise<
|
|
36
|
+
static fromObject(json: any): Promise<Effect>;
|
|
37
37
|
}
|
package/dist/clips/iclip.d.ts
CHANGED
|
@@ -19,10 +19,8 @@ export interface ITransitionInfo {
|
|
|
19
19
|
*
|
|
20
20
|
* Clips are abstractions of different data types, providing data to other modules
|
|
21
21
|
*
|
|
22
|
-
* WebAV provides built-in {@link VideoClip}, {@link AudioClip}, {@link ImageClip} and other common clips for providing data to {@link Compositor} and {@link AVCanvas}
|
|
23
22
|
*
|
|
24
23
|
* You only need to implement this interface to create custom clips, giving you maximum flexibility to generate video content such as animations and transition effects
|
|
25
|
-
* @see [Custom Clip](https://webav-tech.github.io/WebAV/demo/2_6-custom-clip)
|
|
26
24
|
*
|
|
27
25
|
*/
|
|
28
26
|
export interface IClip extends Omit<BaseSprite, 'destroy' | 'ready'> {
|
|
@@ -32,6 +30,10 @@ export interface IClip extends Omit<BaseSprite, 'destroy' | 'ready'> {
|
|
|
32
30
|
* Clip type (e.g., 'video', 'image', 'text', 'audio')
|
|
33
31
|
*/
|
|
34
32
|
readonly type: string;
|
|
33
|
+
/**
|
|
34
|
+
* Source URL or identifier for this clip
|
|
35
|
+
*/
|
|
36
|
+
src: string;
|
|
35
37
|
/**
|
|
36
38
|
* Extract data from clip at specified time
|
|
37
39
|
* @param time Time in microseconds
|
|
@@ -97,6 +99,18 @@ export interface IClip extends Omit<BaseSprite, 'destroy' | 'ready'> {
|
|
|
97
99
|
* @returns Array of handle kinds that should be visible
|
|
98
100
|
*/
|
|
99
101
|
getVisibleHandles?: () => Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
|
|
102
|
+
/**
|
|
103
|
+
* Scale clip to fit within the scene dimensions while maintaining aspect ratio
|
|
104
|
+
*/
|
|
105
|
+
scaleToFit(sceneWidth: number, sceneHeight: number): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Scale clip to fill the scene dimensions while maintaining aspect ratio
|
|
108
|
+
*/
|
|
109
|
+
scaleToFill(sceneWidth: number, sceneHeight: number): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Center the clip within the scene dimensions
|
|
112
|
+
*/
|
|
113
|
+
centerInScene(sceneWidth: number, sceneHeight: number): void;
|
|
100
114
|
}
|
|
101
115
|
/**
|
|
102
116
|
* Optional interface for clips that support HTML media element playback
|
|
@@ -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,
|
|
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,23 +10,22 @@ 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
|
|
13
|
+
* const imgClip = await Image.fromUrl('path/to/image.png');
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* // Traditional approach (for Compositor/export)
|
|
17
|
-
* new
|
|
17
|
+
* new Image((await fetch('<img url>')).body);
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
-
* new
|
|
20
|
+
* new Image(
|
|
21
21
|
* await renderTxt2ImgBitmap(
|
|
22
22
|
* 'Watermark',
|
|
23
23
|
* `font-size:40px; color: white; text-shadow: 2px 2px 6px red;`,
|
|
24
24
|
* )
|
|
25
25
|
* )
|
|
26
26
|
*
|
|
27
|
-
* @see [Video composition](https://webav-tech.github.io/WebAV/demo/2_1-concat-video)
|
|
28
27
|
*/
|
|
29
|
-
export declare class
|
|
28
|
+
export declare class Image extends BaseClip implements IClip {
|
|
30
29
|
readonly type = "Image";
|
|
31
30
|
ready: IClip['ready'];
|
|
32
31
|
private _meta;
|
|
@@ -64,12 +63,12 @@ export declare class ImageClip extends BaseClip implements IClip {
|
|
|
64
63
|
*
|
|
65
64
|
* @param url Image URL
|
|
66
65
|
* @param src Optional source identifier for serialization
|
|
67
|
-
* @returns Promise that resolves to an
|
|
66
|
+
* @returns Promise that resolves to an Image instance
|
|
68
67
|
*
|
|
69
68
|
* @example
|
|
70
|
-
* const imgClip = await
|
|
69
|
+
* const imgClip = await Image.fromUrl('path/to/image.png');
|
|
71
70
|
*/
|
|
72
|
-
static fromUrl(url: string, src?: string): Promise<
|
|
71
|
+
static fromUrl(url: string, src?: string): Promise<Image>;
|
|
73
72
|
/**
|
|
74
73
|
* Get the PixiJS Texture (if available)
|
|
75
74
|
* This is used for optimized rendering in Studio
|
|
@@ -85,7 +84,7 @@ export declare class ImageClip extends BaseClip implements IClip {
|
|
|
85
84
|
stream: ReadableStream;
|
|
86
85
|
}, src?: string);
|
|
87
86
|
private initAnimateImg;
|
|
88
|
-
tickInterceptor: <T extends Awaited<ReturnType<
|
|
87
|
+
tickInterceptor: <T extends Awaited<ReturnType<Image['tick']>>>(time: number, tickRet: T) => Promise<T>;
|
|
89
88
|
tick(time: number): Promise<{
|
|
90
89
|
video: ImageBitmap | VideoFrame;
|
|
91
90
|
state: 'success';
|
|
@@ -105,33 +104,12 @@ export declare class ImageClip extends BaseClip implements IClip {
|
|
|
105
104
|
}>): void;
|
|
106
105
|
removeEffect(effectId: string): void;
|
|
107
106
|
destroy(): void;
|
|
108
|
-
toJSON(main?: boolean):
|
|
107
|
+
toJSON(main?: boolean): ImageJSON;
|
|
109
108
|
/**
|
|
110
|
-
* Create an
|
|
109
|
+
* Create an Image instance from a JSON object (fabric.js pattern)
|
|
111
110
|
* @param json The JSON object representing the clip
|
|
112
|
-
* @returns Promise that resolves to an
|
|
111
|
+
* @returns Promise that resolves to an Image instance
|
|
113
112
|
*/
|
|
114
|
-
static fromObject(json: ClipJSON): Promise<
|
|
115
|
-
/**
|
|
116
|
-
* Scale clip to fit within the scene dimensions while maintaining aspect ratio
|
|
117
|
-
* Similar to fabric.js scaleToFit
|
|
118
|
-
* @param sceneWidth Scene width
|
|
119
|
-
* @param sceneHeight Scene height
|
|
120
|
-
*/
|
|
121
|
-
scaleToFit(sceneWidth: number, sceneHeight: number): Promise<void>;
|
|
122
|
-
/**
|
|
123
|
-
* Scale clip to fill the scene dimensions while maintaining aspect ratio
|
|
124
|
-
* May crop parts of the clip. Similar to fabric.js scaleToFill
|
|
125
|
-
* @param sceneWidth Scene width
|
|
126
|
-
* @param sceneHeight Scene height
|
|
127
|
-
*/
|
|
128
|
-
scaleToFill(sceneWidth: number, sceneHeight: number): Promise<void>;
|
|
129
|
-
/**
|
|
130
|
-
* Center the clip within the scene dimensions
|
|
131
|
-
* Similar to fabric.js center
|
|
132
|
-
* @param sceneWidth Scene width
|
|
133
|
-
* @param sceneHeight Scene height
|
|
134
|
-
*/
|
|
135
|
-
centerInScene(sceneWidth: number, sceneHeight: number): void;
|
|
113
|
+
static fromObject(json: ClipJSON): Promise<Image>;
|
|
136
114
|
}
|
|
137
115
|
export {};
|
package/dist/clips/index.d.ts
CHANGED
|
@@ -3,8 +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 {
|
|
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';
|
|
11
|
+
export * from './placeholder-clip';
|
|
12
|
+
export { Placeholder } from './placeholder-clip';
|
|
10
13
|
export * from './transition-clip';
|
|
14
|
+
export { Transition } from './transition-clip';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseClip } from './base-clip';
|
|
2
|
+
import { IClipMeta } from './iclip';
|
|
3
|
+
export declare class Placeholder extends BaseClip {
|
|
4
|
+
type: string;
|
|
5
|
+
meta: IClipMeta;
|
|
6
|
+
constructor(src: string, meta?: Partial<IClipMeta>, type?: string);
|
|
7
|
+
private placeholderFrame;
|
|
8
|
+
tick(time: number): Promise<{
|
|
9
|
+
video?: ImageBitmap | null;
|
|
10
|
+
audio?: Float32Array[];
|
|
11
|
+
state: 'done' | 'success';
|
|
12
|
+
}>;
|
|
13
|
+
clone(): Promise<this>;
|
|
14
|
+
split(time: number): Promise<[this, this]>;
|
|
15
|
+
}
|
|
@@ -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 {
|
|
5
|
-
export interface
|
|
4
|
+
import { TextJSON } from '../json-serialization';
|
|
5
|
+
export interface ITextOpts {
|
|
6
6
|
/**
|
|
7
7
|
* Font size in pixels
|
|
8
8
|
* @default 40
|
|
@@ -23,6 +23,10 @@ export interface ITextClipOpts {
|
|
|
23
23
|
* @default 'normal'
|
|
24
24
|
*/
|
|
25
25
|
fontStyle?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Font URL for custom fonts
|
|
28
|
+
*/
|
|
29
|
+
fontUrl?: string;
|
|
26
30
|
/**
|
|
27
31
|
* Text color (hex string, color name, or gradient object)
|
|
28
32
|
* @default '#ffffff'
|
|
@@ -112,7 +116,7 @@ export interface ITextClipOpts {
|
|
|
112
116
|
* Text clip using PixiJS Text for rendering
|
|
113
117
|
*
|
|
114
118
|
* @example
|
|
115
|
-
* const textClip = new
|
|
119
|
+
* const textClip = new Text('Hello World', {
|
|
116
120
|
* fontSize: 48,
|
|
117
121
|
* fill: '#ffffff',
|
|
118
122
|
* stroke: '#000000',
|
|
@@ -126,7 +130,7 @@ export interface ITextClipOpts {
|
|
|
126
130
|
* });
|
|
127
131
|
* textClip.duration = 5e6; // 5 seconds
|
|
128
132
|
*/
|
|
129
|
-
export declare class
|
|
133
|
+
export declare class Text extends BaseClip {
|
|
130
134
|
readonly type = "Text";
|
|
131
135
|
ready: IClip['ready'];
|
|
132
136
|
private _meta;
|
|
@@ -156,7 +160,7 @@ export declare class TextClip extends BaseClip {
|
|
|
156
160
|
* Provides direct access to styling properties
|
|
157
161
|
*/
|
|
158
162
|
get style(): any;
|
|
159
|
-
set style(opts: Partial<
|
|
163
|
+
set style(opts: Partial<ITextOpts>);
|
|
160
164
|
/**
|
|
161
165
|
* Text alignment proxy for compatibility with UI
|
|
162
166
|
*/
|
|
@@ -192,7 +196,7 @@ export declare class TextClip extends BaseClip {
|
|
|
192
196
|
startTime: number;
|
|
193
197
|
duration: number;
|
|
194
198
|
}>;
|
|
195
|
-
constructor(text: string, opts?:
|
|
199
|
+
constructor(text: string, opts?: ITextOpts, renderer?: Application['renderer']);
|
|
196
200
|
/**
|
|
197
201
|
* Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
|
|
198
202
|
* This is an optimization for Studio preview
|
|
@@ -233,24 +237,24 @@ export declare class TextClip extends BaseClip {
|
|
|
233
237
|
* Update text styling options and refresh the texture
|
|
234
238
|
* This is used for dynamic updates like resizing with text reflow
|
|
235
239
|
*/
|
|
236
|
-
updateStyle(opts: Partial<
|
|
240
|
+
updateStyle(opts: Partial<ITextOpts>): Promise<void>;
|
|
237
241
|
/**
|
|
238
242
|
* Refresh the internal Pixi Text and RenderTexture
|
|
239
243
|
* Calculates dimensions based on text bounds and wrapping options
|
|
240
244
|
*/
|
|
241
245
|
private refreshText;
|
|
242
246
|
/**
|
|
243
|
-
* Helper to create PixiJS TextStyle options from
|
|
247
|
+
* Helper to create PixiJS TextStyle options from Text options
|
|
244
248
|
*/
|
|
245
249
|
private createStyleFromOpts;
|
|
246
250
|
destroy(): void;
|
|
247
|
-
toJSON(main?: boolean):
|
|
251
|
+
toJSON(main?: boolean): TextJSON;
|
|
248
252
|
/**
|
|
249
|
-
* Create a
|
|
253
|
+
* Create a Text instance from a JSON object (fabric.js pattern)
|
|
250
254
|
* @param json The JSON object representing the clip
|
|
251
|
-
* @returns Promise that resolves to a
|
|
255
|
+
* @returns Promise that resolves to a Text instance
|
|
252
256
|
*/
|
|
253
|
-
static fromObject(json:
|
|
257
|
+
static fromObject(json: TextJSON): Promise<Text>;
|
|
254
258
|
/**
|
|
255
259
|
* Override handle visibility for text clips
|
|
256
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
|
|
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
|
|
42
|
+
* Create a Transition instance from a JSON object
|
|
43
43
|
*/
|
|
44
|
-
static fromObject(json: any): Promise<
|
|
44
|
+
static fromObject(json: any): Promise<Transition>;
|
|
45
45
|
}
|