@designcombo/video 0.0.2 → 0.0.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.
@@ -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-C333riU-.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-BVO9qrk3.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-C333riU-.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-BVO9qrk3.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-BWe03l6N.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-s9Js69L7.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-C333riU-.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-BVO9qrk3.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-BWe03l6N.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-s9Js69L7.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-C333riU-.js";
2
- import "./webworkerAll-aNnyDpl9.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-BVO9qrk3.js";
2
+ import "./webworkerAll-zvzmYHny.js";
3
3
  class q {
4
4
  constructor(e) {
5
5
  this._lastTransform = "", this._observer = null, this._tickerAttached = !1, this.updateTranslation = () => {
@@ -21,6 +21,7 @@ interface IAudioClipOpts {
21
21
  * }),
22
22
  */
23
23
  export declare class AudioClip extends BaseClip implements IPlaybackCapable {
24
+ readonly type = "Audio";
24
25
  static ctx: AudioContext | null;
25
26
  ready: IClip['ready'];
26
27
  private _meta;
@@ -50,7 +51,6 @@ export declare class AudioClip extends BaseClip implements IPlaybackCapable {
50
51
  /**
51
52
  * Audio volume level (0-1) (hybrid JSON structure)
52
53
  */
53
- volume: number;
54
54
  /**
55
55
  * Load an audio clip from a URL
56
56
  * @param url Audio URL
@@ -7,6 +7,7 @@ import { ClipJSON } from '../json-serialization';
7
7
  * and frame management
8
8
  */
9
9
  export declare abstract class BaseClip extends BaseSprite implements IClip {
10
+ abstract readonly type: string;
10
11
  private lastVf;
11
12
  protected destroyed: boolean;
12
13
  /**
@@ -29,7 +29,7 @@ export interface ICaptionClipOpts {
29
29
  * @default '#ffffff'
30
30
  */
31
31
  fill?: string | number | {
32
- type: "gradient";
32
+ type: 'gradient';
33
33
  x0: number;
34
34
  y0: number;
35
35
  x1: number;
@@ -104,7 +104,7 @@ export interface ICaptionClipOpts {
104
104
  stroke?: string | number | {
105
105
  color: string | number;
106
106
  width: number;
107
- join?: "miter" | "round" | "bevel";
107
+ join?: 'miter' | 'round' | 'bevel';
108
108
  };
109
109
  /**
110
110
  * Stroke width in pixels (used when stroke is a simple color)
@@ -115,7 +115,7 @@ export interface ICaptionClipOpts {
115
115
  * Text alignment ('left', 'center', 'right')
116
116
  * @default 'center'
117
117
  */
118
- align?: "left" | "center" | "right";
118
+ align?: 'left' | 'center' | 'right';
119
119
  /**
120
120
  * Drop shadow configuration
121
121
  */
@@ -163,7 +163,8 @@ export interface ICaptionClipOpts {
163
163
  * captionClip.duration = 3e6; // 3 seconds
164
164
  */
165
165
  export declare class CaptionClip extends BaseClip implements IClip {
166
- ready: IClip["ready"];
166
+ readonly type = "Caption";
167
+ ready: IClip['ready'];
167
168
  private _meta;
168
169
  get meta(): {
169
170
  duration: number;
@@ -239,7 +240,7 @@ export declare class CaptionClip extends BaseClip implements IClip {
239
240
  private externalRenderer;
240
241
  private pixiApp;
241
242
  private originalOpts;
242
- constructor(text: string, opts?: ICaptionClipOpts, renderer?: Application["renderer"]);
243
+ constructor(text: string, opts?: ICaptionClipOpts, renderer?: Application['renderer']);
243
244
  private lastLoggedTime;
244
245
  updateState(currentTime: number): void;
245
246
  /**
@@ -252,11 +253,11 @@ export declare class CaptionClip extends BaseClip implements IClip {
252
253
  /**
253
254
  * Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
254
255
  */
255
- setRenderer(renderer: Application["renderer"]): void;
256
+ setRenderer(renderer: Application['renderer']): void;
256
257
  private getRenderer;
257
258
  tick(time: number): Promise<{
258
259
  video: ImageBitmap;
259
- state: "success";
260
+ state: 'success';
260
261
  }>;
261
262
  split(_time: number): Promise<[this, this]>;
262
263
  addEffect(effect: {
@@ -0,0 +1,33 @@
1
+ import { BaseClip } from './base-clip';
2
+ import { IClip } from './iclip';
3
+ import { EffectKey } from '../effect/glsl/gl-effect';
4
+ export declare class EffectClip extends BaseClip {
5
+ readonly type = "Effect";
6
+ ready: IClip['ready'];
7
+ private _meta;
8
+ get meta(): {
9
+ duration: number;
10
+ width: number;
11
+ height: number;
12
+ };
13
+ /**
14
+ * Unique identifier for this clip instance
15
+ */
16
+ id: string;
17
+ /**
18
+ * The effect configuration
19
+ */
20
+ effect: {
21
+ id: string;
22
+ key: EffectKey;
23
+ name: string;
24
+ };
25
+ constructor(effectKey: EffectKey);
26
+ clone(): Promise<this>;
27
+ tick(_time: number): Promise<{
28
+ video: ImageBitmap | undefined;
29
+ state: 'success';
30
+ }>;
31
+ split(_time: number): Promise<[this, this]>;
32
+ toJSON(main?: boolean): any;
33
+ }
@@ -18,6 +18,10 @@ export interface IClipMeta {
18
18
  export interface IClip extends Omit<BaseSprite, 'destroy' | 'ready'> {
19
19
  destroy: () => void;
20
20
  readonly ready: Promise<IClipMeta>;
21
+ /**
22
+ * Clip type (e.g., 'video', 'image', 'text', 'audio')
23
+ */
24
+ readonly type: string;
21
25
  /**
22
26
  * Extract data from clip at specified time
23
27
  * @param time Time in microseconds
@@ -26,7 +26,8 @@ type AnimateImgType = 'avif' | 'webp' | 'png' | 'gif';
26
26
  *
27
27
  * @see [Video composition](https://webav-tech.github.io/WebAV/demo/2_1-concat-video)
28
28
  */
29
- export declare class ImageClip extends BaseClip {
29
+ export declare class ImageClip extends BaseClip implements IClip {
30
+ readonly type = "Image";
30
31
  ready: IClip['ready'];
31
32
  private _meta;
32
33
  /**
@@ -6,3 +6,4 @@ export * from './video-clip';
6
6
  export { VideoClip } from './video-clip';
7
7
  export type { IMP4ClipOpts } from './video-clip';
8
8
  export * from './text-clip';
9
+ export * from './effect-clip';
@@ -10,7 +10,7 @@ export interface ITextClipOpts {
10
10
  fontSize?: number;
11
11
  /**
12
12
  * Font family
13
- * @default 'Arial'
13
+ * @default 'Roboto'
14
14
  */
15
15
  fontFamily?: string;
16
16
  /**
@@ -28,7 +28,7 @@ export interface ITextClipOpts {
28
28
  * @default '#ffffff'
29
29
  */
30
30
  fill?: string | number | {
31
- type: "gradient";
31
+ type: 'gradient';
32
32
  x0: number;
33
33
  y0: number;
34
34
  x1: number;
@@ -44,8 +44,8 @@ export interface ITextClipOpts {
44
44
  stroke?: string | number | {
45
45
  color: string | number;
46
46
  width: number;
47
- join?: "miter" | "round" | "bevel";
48
- cap?: "butt" | "round" | "square";
47
+ join?: 'miter' | 'round' | 'bevel';
48
+ cap?: 'butt' | 'round' | 'square';
49
49
  miterLimit?: number;
50
50
  };
51
51
  /**
@@ -57,7 +57,7 @@ export interface ITextClipOpts {
57
57
  * Text alignment ('left', 'center', 'right')
58
58
  * @default 'left'
59
59
  */
60
- align?: "left" | "center" | "right";
60
+ align?: 'left' | 'center' | 'right';
61
61
  /**
62
62
  * Drop shadow configuration
63
63
  */
@@ -88,6 +88,16 @@ export interface ITextClipOpts {
88
88
  * @default 0
89
89
  */
90
90
  letterSpacing?: number;
91
+ /**
92
+ * Text case transformation
93
+ * @default 'none'
94
+ */
95
+ textCase?: 'none' | 'uppercase' | 'lowercase' | 'title';
96
+ /**
97
+ * Text decoration ('none', 'underline', 'line-through', 'overline')
98
+ * @default 'none'
99
+ */
100
+ textDecoration?: 'none' | 'underline' | 'line-through' | 'overline';
91
101
  }
92
102
  /**
93
103
  * Text clip using PixiJS Text for rendering
@@ -108,7 +118,8 @@ export interface ITextClipOpts {
108
118
  * textClip.duration = 5e6; // 5 seconds
109
119
  */
110
120
  export declare class TextClip extends BaseClip {
111
- ready: IClip["ready"];
121
+ readonly type = "Text";
122
+ ready: IClip['ready'];
112
123
  private _meta;
113
124
  get meta(): {
114
125
  duration: number;
@@ -143,7 +154,7 @@ export declare class TextClip extends BaseClip {
143
154
  stroke: {
144
155
  color: string | number;
145
156
  width: number;
146
- join: "miter" | "round" | "bevel" | undefined;
157
+ join: "round" | "miter" | "bevel" | undefined;
147
158
  cap: "round" | "butt" | "square" | undefined;
148
159
  miterLimit: number | undefined;
149
160
  } | {
@@ -164,6 +175,8 @@ export declare class TextClip extends BaseClip {
164
175
  wordWrapWidth: number | undefined;
165
176
  lineHeight: number | undefined;
166
177
  letterSpacing: number | undefined;
178
+ textCase: "title" | "none" | "uppercase" | "lowercase" | undefined;
179
+ textDecoration: "none" | "underline" | "line-through" | "overline" | undefined;
167
180
  };
168
181
  private pixiText;
169
182
  private textStyle;
@@ -185,13 +198,13 @@ export declare class TextClip extends BaseClip {
185
198
  startTime: number;
186
199
  duration: number;
187
200
  }>;
188
- constructor(text: string, opts?: ITextClipOpts, renderer?: Application["renderer"]);
201
+ constructor(text: string, opts?: ITextClipOpts, renderer?: Application['renderer']);
189
202
  /**
190
203
  * Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
191
204
  * This is an optimization for Studio preview
192
205
  * Can be called before ready() completes
193
206
  */
194
- setRenderer(renderer: Application["renderer"]): void;
207
+ setRenderer(renderer: Application['renderer']): void;
195
208
  /**
196
209
  * Get the renderer for rendering text to RenderTexture
197
210
  * Creates a minimal renderer as fallback if no external renderer is provided
@@ -206,7 +219,7 @@ export declare class TextClip extends BaseClip {
206
219
  getTexture(): Promise<Texture | null>;
207
220
  tick(_time: number): Promise<{
208
221
  video: ImageBitmap;
209
- state: "success";
222
+ state: 'success';
210
223
  }>;
211
224
  split(_time: number): Promise<[this, this]>;
212
225
  addEffect(effect: {
@@ -20,7 +20,7 @@ export interface IMP4ClipOpts {
20
20
  */
21
21
  __unsafe_hardwareAcceleration__?: HardwarePreference;
22
22
  }
23
- type ExtMP4Sample = Omit<MP4Sample, "data"> & {
23
+ type ExtMP4Sample = Omit<MP4Sample, 'data'> & {
24
24
  is_idr: boolean;
25
25
  deleted?: boolean;
26
26
  data: null | Uint8Array;
@@ -32,7 +32,7 @@ type ExtMP4Sample = Omit<MP4Sample, "data"> & {
32
32
  *
33
33
  * @example
34
34
  * // Load video clip asynchronously
35
- * const videoClip = await VideoClip.fromUrl("clip.mp4", {
35
+ * const videoClip = await VideoClip.fromUrl('clip.mp4', {
36
36
  * x: 0,
37
37
  * y: 0,
38
38
  * width: 1920,
@@ -58,9 +58,10 @@ type ExtMP4Sample = Omit<MP4Sample, "data"> & {
58
58
  * @see [Decode and play video](https://webav-tech.github.io/WebAV/demo/1_1-decode-video)
59
59
  */
60
60
  export declare class VideoClip extends BaseClip implements IPlaybackCapable {
61
+ readonly type = "Video";
61
62
  private insId;
62
63
  private logger;
63
- ready: IClip["ready"];
64
+ ready: IClip['ready'];
64
65
  private _meta;
65
66
  get meta(): {
66
67
  duration: number;
@@ -81,7 +82,6 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
81
82
  /** Store video transform and rotation info, currently only restores rotation */
82
83
  private parsedMatrix;
83
84
  private vfRotater;
84
- private volume;
85
85
  private videoSamples;
86
86
  private audioSamples;
87
87
  private videoFrameFinder;
@@ -113,7 +113,7 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
113
113
  * @returns Promise that resolves to a video clip
114
114
  *
115
115
  * @example
116
- * const videoClip = await VideoClip.fromUrl("clip.mp4", {
116
+ * const videoClip = await VideoClip.fromUrl('clip.mp4', {
117
117
  * x: 0,
118
118
  * y: 0,
119
119
  * width: 1920,
@@ -127,6 +127,8 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
127
127
  height?: number;
128
128
  }): Promise<VideoClip>;
129
129
  constructor(source: OPFSToolFile | ReadableStream<Uint8Array> | MPClipCloneArgs, opts?: IMP4ClipOpts, src?: string);
130
+ set volume(v: number);
131
+ get volume(): number;
130
132
  /**
131
133
  * Intercept data returned by {@link VideoClip.tick} method for secondary processing of image and audio data
132
134
  * @param time Time when tick was called
@@ -134,7 +136,7 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
134
136
  *
135
137
  * @see [Remove video green screen background](https://webav-tech.github.io/WebAV/demo/3_2-chromakey-video)
136
138
  */
137
- tickInterceptor: <T extends Awaited<ReturnType<VideoClip["tick"]>>>(time: number, tickRet: T) => Promise<T>;
139
+ tickInterceptor: <T extends Awaited<ReturnType<VideoClip['tick']>>>(time: number, tickRet: T) => Promise<T>;
138
140
  /**
139
141
  * Get image frame and audio data at specified time
140
142
  * @param time Time in microseconds
@@ -142,7 +144,7 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
142
144
  tick(time: number): Promise<{
143
145
  video?: VideoFrame;
144
146
  audio: Float32Array[];
145
- state: "success" | "done";
147
+ state: 'success' | 'done';
146
148
  }>;
147
149
  split(time: number): Promise<[this, this]>;
148
150
  addEffect(effect: {