@designcombo/video 0.0.1 → 0.0.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.
@@ -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;
@@ -60,7 +60,7 @@ type ExtMP4Sample = Omit<MP4Sample, 'data'> & {
60
60
  export declare class VideoClip extends BaseClip implements IPlaybackCapable {
61
61
  private insId;
62
62
  private logger;
63
- ready: IClip['ready'];
63
+ ready: IClip["ready"];
64
64
  private _meta;
65
65
  get meta(): {
66
66
  duration: number;
@@ -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
@@ -120,7 +134,7 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
120
134
  *
121
135
  * @see [Remove video green screen background](https://webav-tech.github.io/WebAV/demo/3_2-chromakey-video)
122
136
  */
123
- tickInterceptor: <T extends Awaited<ReturnType<VideoClip['tick']>>>(time: number, tickRet: T) => Promise<T>;
137
+ tickInterceptor: <T extends Awaited<ReturnType<VideoClip["tick"]>>>(time: number, tickRet: T) => Promise<T>;
124
138
  /**
125
139
  * Get image frame and audio data at specified time
126
140
  * @param time Time in microseconds
@@ -128,9 +142,21 @@ export declare class VideoClip extends BaseClip implements IPlaybackCapable {
128
142
  tick(time: number): Promise<{
129
143
  video?: VideoFrame;
130
144
  audio: Float32Array[];
131
- state: 'success' | 'done';
145
+ state: "success" | "done";
132
146
  }>;
133
147
  split(time: number): Promise<[this, this]>;
148
+ addEffect(effect: {
149
+ id: string;
150
+ key: string;
151
+ startTime: number;
152
+ duration: number;
153
+ }): void;
154
+ editEffect(effectId: string, newEffectData: Partial<{
155
+ key: string;
156
+ startTime: number;
157
+ duration: number;
158
+ }>): void;
159
+ removeEffect(effectId: string): void;
134
160
  clone(): Promise<this>;
135
161
  /**
136
162
  * 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
+ };