@designcombo/video 0.0.1 → 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.
@@ -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
  /**
@@ -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,6 +118,7 @@ export interface ITextClipOpts {
108
118
  * textClip.duration = 5e6; // 5 seconds
109
119
  */
110
120
  export declare class TextClip extends BaseClip {
121
+ readonly type = "Text";
111
122
  ready: IClip['ready'];
112
123
  private _meta;
113
124
  get meta(): {
@@ -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;
@@ -171,6 +184,20 @@ export declare class TextClip extends BaseClip {
171
184
  private externalRenderer;
172
185
  private pixiApp;
173
186
  private originalOpts;
187
+ /**
188
+ * Unique identifier for this clip instance
189
+ */
190
+ id: string;
191
+ /**
192
+ * Array of effects to be applied to this clip
193
+ * Each effect specifies key, startTime, duration, and optional targets
194
+ */
195
+ effects: Array<{
196
+ id: string;
197
+ key: string;
198
+ startTime: number;
199
+ duration: number;
200
+ }>;
174
201
  constructor(text: string, opts?: ITextClipOpts, renderer?: Application['renderer']);
175
202
  /**
176
203
  * Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
@@ -195,6 +222,18 @@ export declare class TextClip extends BaseClip {
195
222
  state: 'success';
196
223
  }>;
197
224
  split(_time: number): Promise<[this, this]>;
225
+ addEffect(effect: {
226
+ id: string;
227
+ key: string;
228
+ startTime: number;
229
+ duration: number;
230
+ }): void;
231
+ editEffect(effectId: string, newEffectData: Partial<{
232
+ key: string;
233
+ startTime: number;
234
+ duration: number;
235
+ }>): void;
236
+ removeEffect(effectId: string): void;
198
237
  clone(): Promise<this>;
199
238
  /**
200
239
  * Update text styling options and refresh the texture
@@ -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,6 +58,7 @@ 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
64
  ready: IClip['ready'];
@@ -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;
@@ -92,6 +92,20 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
92
92
  * Whether to include audio track (hybrid JSON structure)
93
93
  */
94
94
  audio: boolean;
95
+ /**
96
+ * Unique identifier for this clip instance
97
+ */
98
+ id: string;
99
+ /**
100
+ * Array of effects to be applied to this clip
101
+ * Each effect specifies key, startTime, duration, and optional targets
102
+ */
103
+ effects: Array<{
104
+ id: string;
105
+ key: string;
106
+ startTime: number;
107
+ duration: number;
108
+ }>;
95
109
  /**
96
110
  * Load a video clip from a URL
97
111
  * @param url Video URL
@@ -99,7 +113,7 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
99
113
  * @returns Promise that resolves to a video clip
100
114
  *
101
115
  * @example
102
- * const videoClip = await VideoClip.fromUrl("clip.mp4", {
116
+ * const videoClip = await VideoClip.fromUrl('clip.mp4', {
103
117
  * x: 0,
104
118
  * y: 0,
105
119
  * width: 1920,
@@ -113,6 +127,8 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
113
127
  height?: number;
114
128
  }): Promise<VideoClip>;
115
129
  constructor(source: OPFSToolFile | ReadableStream<Uint8Array> | MPClipCloneArgs, opts?: IMP4ClipOpts, src?: string);
130
+ set volume(v: number);
131
+ get volume(): number;
116
132
  /**
117
133
  * Intercept data returned by {@link VideoClip.tick} method for secondary processing of image and audio data
118
134
  * @param time Time when tick was called
@@ -131,6 +147,18 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
131
147
  state: 'success' | 'done';
132
148
  }>;
133
149
  split(time: number): Promise<[this, this]>;
150
+ addEffect(effect: {
151
+ id: string;
152
+ key: string;
153
+ startTime: number;
154
+ duration: number;
155
+ }): void;
156
+ editEffect(effectId: string, newEffectData: Partial<{
157
+ key: string;
158
+ startTime: number;
159
+ duration: number;
160
+ }>): void;
161
+ removeEffect(effectId: string): void;
134
162
  clone(): Promise<this>;
135
163
  /**
136
164
  * Split VideoClip into VideoClips containing only video track and audio track
@@ -0,0 +1,97 @@
1
+ const l = {
2
+ name: "local-uniform-bit",
3
+ vertex: {
4
+ header: (
5
+ /* wgsl */
6
+ `
7
+
8
+ struct LocalUniforms {
9
+ uTransformMatrix:mat3x3<f32>,
10
+ uColor:vec4<f32>,
11
+ uRound:f32,
12
+ }
13
+
14
+ @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
15
+ `
16
+ ),
17
+ main: (
18
+ /* wgsl */
19
+ `
20
+ vColor *= localUniforms.uColor;
21
+ modelMatrix *= localUniforms.uTransformMatrix;
22
+ `
23
+ ),
24
+ end: (
25
+ /* wgsl */
26
+ `
27
+ if(localUniforms.uRound == 1)
28
+ {
29
+ vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
30
+ }
31
+ `
32
+ )
33
+ }
34
+ }, e = {
35
+ ...l,
36
+ vertex: {
37
+ ...l.vertex,
38
+ // replace the group!
39
+ header: l.vertex.header.replace("group(1)", "group(2)")
40
+ }
41
+ }, n = {
42
+ name: "local-uniform-bit",
43
+ vertex: {
44
+ header: (
45
+ /* glsl */
46
+ `
47
+
48
+ uniform mat3 uTransformMatrix;
49
+ uniform vec4 uColor;
50
+ uniform float uRound;
51
+ `
52
+ ),
53
+ main: (
54
+ /* glsl */
55
+ `
56
+ vColor *= uColor;
57
+ modelMatrix = uTransformMatrix;
58
+ `
59
+ ),
60
+ end: (
61
+ /* glsl */
62
+ `
63
+ if(uRound == 1.)
64
+ {
65
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
66
+ }
67
+ `
68
+ )
69
+ }
70
+ };
71
+ class a {
72
+ constructor() {
73
+ this.batcherName = "default", this.topology = "triangle-list", this.attributeSize = 4, this.indexSize = 6, this.packAsQuad = !0, this.roundPixels = 0, this._attributeStart = 0, this._batcher = null, this._batch = null;
74
+ }
75
+ get blendMode() {
76
+ return this.renderable.groupBlendMode;
77
+ }
78
+ get color() {
79
+ return this.renderable.groupColorAlpha;
80
+ }
81
+ reset() {
82
+ this.renderable = null, this.texture = null, this._batcher = null, this._batch = null, this.bounds = null;
83
+ }
84
+ destroy() {
85
+ }
86
+ }
87
+ function s(o, r, i) {
88
+ const t = (o >> 24 & 255) / 255;
89
+ r[i++] = (o & 255) / 255 * t, r[i++] = (o >> 8 & 255) / 255 * t, r[i++] = (o >> 16 & 255) / 255 * t, r[i++] = t;
90
+ }
91
+ export {
92
+ a as B,
93
+ l as a,
94
+ n as b,
95
+ s as c,
96
+ e as l
97
+ };
@@ -0,0 +1,6 @@
1
+ import { Filter, RenderTexture } from 'pixi.js';
2
+ import { EffectOptions, EffectRendererOptions } from './types';
3
+ export declare function makeEffect({ name, renderer }: EffectOptions): {
4
+ filter: Filter;
5
+ render({ width, height, canvasTexture, progress }: EffectRendererOptions): RenderTexture;
6
+ };