openvideo 0.2.15 → 0.2.17

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,5 +1,5 @@
1
- import { e as a, A as e, C as i, a as s, E as t, F as n, D as d } from "./index-CqBdAdbt.js";
2
- import "./webworkerAll-05Hpn3rq.js";
1
+ import { e as a, A as e, C as i, a as s, E as t, F as n, D as d } from "./index-Gj63TxQW.js";
2
+ import "./webworkerAll-S6vnaIy0.js";
3
3
  a.add(e);
4
4
  a.mixin(i, s);
5
5
  a.add(t);
@@ -15,6 +15,10 @@ export declare abstract class BaseClip<T extends BaseSpriteEvents = BaseSpriteEv
15
15
  * Used for serialization and reloading from JSON
16
16
  */
17
17
  src: string;
18
+ /**
19
+ * User-defined metadata
20
+ */
21
+ metadata: Record<string, any>;
18
22
  /**
19
23
  * Transition info (optional)
20
24
  */
@@ -4,8 +4,8 @@ import { CaptionJSON, ICaptionWordAnimation } from '../json-serialization';
4
4
  import { Application, Texture } from 'pixi.js';
5
5
  import { BaseSpriteEvents } from '../sprite/base-sprite';
6
6
  export interface ITextBoxStyle {
7
- style?: "tiktok" | "none";
8
- textAlign?: "left" | "center" | "right" | "";
7
+ style?: 'tiktok' | 'none';
8
+ textAlign?: 'left' | 'center' | 'right' | '';
9
9
  maxLines?: number;
10
10
  borderRadius?: number;
11
11
  horizontalPadding?: number;
@@ -16,11 +16,11 @@ export interface ICaptionStyle {
16
16
  fontFamily?: string;
17
17
  fontWeight?: string | number;
18
18
  fontStyle?: string;
19
- color?: ICaptionOpts["fill"];
20
- align?: ICaptionOpts["align"];
21
- textCase?: ICaptionOpts["textCase"];
22
- verticalAlign?: ICaptionOpts["verticalAlign"];
23
- wordsPerLine?: ICaptionOpts["wordsPerLine"];
19
+ color?: ICaptionOpts['fill'];
20
+ align?: ICaptionOpts['align'];
21
+ textCase?: ICaptionOpts['textCase'];
22
+ verticalAlign?: ICaptionOpts['verticalAlign'];
23
+ wordsPerLine?: ICaptionOpts['wordsPerLine'];
24
24
  stroke?: {
25
25
  color: string | number;
26
26
  width: number;
@@ -46,14 +46,14 @@ export interface ICaptionEvents extends BaseSpriteEvents {
46
46
  opacity: number;
47
47
  volume: number;
48
48
  text: string;
49
- words: ICaptionOpts["words"];
50
- fill: ICaptionOpts["fill"];
51
- align: ICaptionOpts["align"];
52
- textCase: ICaptionOpts["textCase"];
53
- stroke: ICaptionOpts["stroke"];
54
- dropShadow: ICaptionOpts["dropShadow"];
55
- caption: ICaptionOpts["caption"];
56
- wordsPerLine: ICaptionOpts["wordsPerLine"];
49
+ words: ICaptionOpts['words'];
50
+ fill: ICaptionOpts['fill'];
51
+ align: ICaptionOpts['align'];
52
+ textCase: ICaptionOpts['textCase'];
53
+ stroke: ICaptionOpts['stroke'];
54
+ dropShadow: ICaptionOpts['dropShadow'];
55
+ caption: ICaptionOpts['caption'];
56
+ wordsPerLine: ICaptionOpts['wordsPerLine'];
57
57
  textBoxStyle: ITextBoxStyle;
58
58
  }>;
59
59
  }
@@ -84,7 +84,7 @@ export interface ICaptionOpts {
84
84
  * @default '#ffffff'
85
85
  */
86
86
  fill?: string | number | {
87
- type: "gradient";
87
+ type: 'gradient';
88
88
  x0: number;
89
89
  y0: number;
90
90
  x1: number;
@@ -163,7 +163,7 @@ export interface ICaptionOpts {
163
163
  stroke?: string | number | {
164
164
  color: string | number;
165
165
  width: number;
166
- join?: "miter" | "round" | "bevel";
166
+ join?: 'miter' | 'round' | 'bevel';
167
167
  };
168
168
  /**
169
169
  * Stroke width in pixels (used when stroke is a simple color)
@@ -174,7 +174,7 @@ export interface ICaptionOpts {
174
174
  * Text alignment ('left', 'center', 'right')
175
175
  * @default 'center'
176
176
  */
177
- align?: "left" | "center" | "right";
177
+ align?: 'left' | 'center' | 'right';
178
178
  /**
179
179
  * Drop shadow configuration
180
180
  */
@@ -194,7 +194,7 @@ export interface ICaptionOpts {
194
194
  * Word wrap mode ('break-word' or 'normal')
195
195
  * @default 'break-word'
196
196
  */
197
- wordWrapMode?: "break-word" | "normal";
197
+ wordWrapMode?: 'break-word' | 'normal';
198
198
  /**
199
199
  * Whether to enable word wrap
200
200
  * @default true
@@ -204,7 +204,7 @@ export interface ICaptionOpts {
204
204
  * Vertical alignment ('top', 'center', 'bottom')
205
205
  * @default 'bottom'
206
206
  */
207
- verticalAlign?: "top" | "center" | "bottom";
207
+ verticalAlign?: 'top' | 'center' | 'bottom';
208
208
  /**
209
209
  * Line height (multiplier)
210
210
  * @default 1
@@ -219,7 +219,7 @@ export interface ICaptionOpts {
219
219
  * Text case transformation
220
220
  * @default 'none'
221
221
  */
222
- textCase?: "none" | "uppercase" | "lowercase" | "title";
222
+ textCase?: 'none' | 'uppercase' | 'lowercase' | 'title';
223
223
  /**
224
224
  * Media ID to which the captions were applied
225
225
  */
@@ -232,7 +232,7 @@ export interface ICaptionOpts {
232
232
  * Words per line mode ('single' or 'multiple')
233
233
  * @default 'multiple'
234
234
  */
235
- wordsPerLine?: "single" | "multiple";
235
+ wordsPerLine?: 'single' | 'multiple';
236
236
  wordAnimation?: ICaptionWordAnimation;
237
237
  textBoxStyle?: ITextBoxStyle;
238
238
  }
@@ -253,7 +253,7 @@ export interface ICaptionOpts {
253
253
  */
254
254
  export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
255
255
  readonly type = "Caption";
256
- ready: IClip["ready"];
256
+ ready: IClip['ready'];
257
257
  private _meta;
258
258
  get meta(): {
259
259
  duration: number;
@@ -286,8 +286,8 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
286
286
  set text(v: string);
287
287
  get style(): ICaptionStyle;
288
288
  set style(v: Partial<ICaptionOpts> | ICaptionStyle);
289
- get wordsPerLine(): "single" | "multiple";
290
- set wordsPerLine(v: "single" | "multiple");
289
+ get wordsPerLine(): 'single' | 'multiple';
290
+ set wordsPerLine(v: 'single' | 'multiple');
291
291
  get fontFamily(): string;
292
292
  set fontFamily(v: string);
293
293
  get fontUrl(): string;
@@ -296,20 +296,20 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
296
296
  set fontSize(v: number);
297
297
  get fontWeight(): string | number;
298
298
  set fontWeight(v: string | number);
299
- get fontStyle(): "normal" | "italic" | "oblique";
300
- set fontStyle(v: "normal" | "italic" | "oblique");
301
- get fill(): ICaptionOpts["fill"];
302
- set fill(v: ICaptionOpts["fill"]);
303
- get align(): "left" | "center" | "right";
304
- set align(v: "left" | "center" | "right");
305
- get stroke(): ICaptionOpts["stroke"];
306
- set stroke(v: ICaptionOpts["stroke"]);
299
+ get fontStyle(): 'normal' | 'italic' | 'oblique';
300
+ set fontStyle(v: 'normal' | 'italic' | 'oblique');
301
+ get fill(): ICaptionOpts['fill'];
302
+ set fill(v: ICaptionOpts['fill']);
303
+ get align(): 'left' | 'center' | 'right';
304
+ set align(v: 'left' | 'center' | 'right');
305
+ get stroke(): ICaptionOpts['stroke'];
306
+ set stroke(v: ICaptionOpts['stroke']);
307
307
  get strokeWidth(): number;
308
308
  set strokeWidth(v: number);
309
- get dropShadow(): ICaptionOpts["dropShadow"];
310
- set dropShadow(v: ICaptionOpts["dropShadow"]);
311
- get caption(): ICaptionOpts["caption"];
312
- set caption(v: ICaptionOpts["caption"]);
309
+ get dropShadow(): ICaptionOpts['dropShadow'];
310
+ set dropShadow(v: ICaptionOpts['dropShadow']);
311
+ get caption(): ICaptionOpts['caption'];
312
+ set caption(v: ICaptionOpts['caption']);
313
313
  get textBoxStyle(): ITextBoxStyle;
314
314
  set textBoxStyle(v: ITextBoxStyle);
315
315
  /**
@@ -320,7 +320,7 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
320
320
  * Text case proxy
321
321
  */
322
322
  get textCase(): string;
323
- set textCase(v: "none" | "uppercase" | "lowercase" | "title");
323
+ set textCase(v: 'none' | 'uppercase' | 'lowercase' | 'title');
324
324
  /**
325
325
  * Unique identifier for this clip instance
326
326
  */
@@ -347,7 +347,7 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
347
347
  /**
348
348
  * Words setter that triggers re-render and ensures consistency
349
349
  */
350
- set words(v: ICaptionOpts["words"]);
350
+ set words(v: ICaptionOpts['words']);
351
351
  private opts;
352
352
  private pixiTextContainer;
353
353
  private renderTexture;
@@ -359,7 +359,7 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
359
359
  private externalRenderer;
360
360
  private pixiApp;
361
361
  private originalOpts;
362
- constructor(text: string, opts?: ICaptionOpts, renderer?: Application["renderer"]);
362
+ constructor(text: string, opts?: ICaptionOpts, renderer?: Application['renderer']);
363
363
  /**
364
364
  * Update text styling options and refresh the caption rendering
365
365
  */
@@ -378,11 +378,11 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
378
378
  /**
379
379
  * Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
380
380
  */
381
- setRenderer(renderer: Application["renderer"]): void;
381
+ setRenderer(renderer: Application['renderer']): void;
382
382
  private getRenderer;
383
383
  tick(time: number): Promise<{
384
384
  video: ImageBitmap;
385
- state: "success";
385
+ state: 'success';
386
386
  }>;
387
387
  split(_time: number): Promise<[this, this]>;
388
388
  addEffect(effect: {
@@ -406,6 +406,6 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
406
406
  * @returns Promise that resolves to a Caption instance
407
407
  */
408
408
  static fromObject(json: CaptionJSON): Promise<Caption>;
409
- getVisibleHandles(): Array<"tl" | "tr" | "bl" | "br" | "ml" | "mr" | "mt" | "mb" | "rot">;
409
+ getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
410
410
  private drawRoundedTiktokPath;
411
411
  }
@@ -1,4 +1,5 @@
1
1
  import { BaseSprite, BaseSpriteEvents } from '../sprite/base-sprite';
2
+ import { ColorAdjustment } from '../utils/color-adjustment';
2
3
  export interface IClipMeta {
3
4
  width: number;
4
5
  height: number;
@@ -40,6 +41,10 @@ export interface IClip<T extends BaseSpriteEvents = BaseSpriteEvents> extends Om
40
41
  * Name of this clip
41
42
  */
42
43
  name: string;
44
+ /**
45
+ * User-defined metadata
46
+ */
47
+ metadata: Record<string, any>;
43
48
  /**
44
49
  * Source URL or identifier for this clip
45
50
  */
@@ -144,6 +149,10 @@ export interface IClip<T extends BaseSpriteEvents = BaseSpriteEvents> extends Om
144
149
  * Chroma key settings (green screen removal)
145
150
  */
146
151
  chromaKey: IChromaKeyOpts;
152
+ /**
153
+ * Clip color adjustment settings
154
+ */
155
+ colorAdjustment: ColorAdjustment;
147
156
  /**
148
157
  * Whether the clip is locked (preventing interactions)
149
158
  */
@@ -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;
@@ -57,7 +57,7 @@ export declare class Video extends BaseClip implements IPlaybackCapable {
57
57
  readonly type = "Video";
58
58
  private insId;
59
59
  private logger;
60
- ready: IClip['ready'];
60
+ ready: IClip["ready"];
61
61
  private _meta;
62
62
  get meta(): {
63
63
  duration: number;
@@ -129,7 +129,7 @@ export declare class Video extends BaseClip implements IPlaybackCapable {
129
129
  * @param tickRet Data returned by tick
130
130
  *
131
131
  * */
132
- tickInterceptor: <T extends Awaited<ReturnType<Video['tick']>>>(time: number, tickRet: T) => Promise<T>;
132
+ tickInterceptor: <T extends Awaited<ReturnType<Video["tick"]>>>(time: number, tickRet: T) => Promise<T>;
133
133
  /**
134
134
  * Get image frame and audio data at specified time
135
135
  * @param time Time in microseconds
@@ -137,7 +137,7 @@ export declare class Video extends BaseClip implements IPlaybackCapable {
137
137
  tick(time: number): Promise<{
138
138
  video?: VideoFrame;
139
139
  audio: Float32Array[];
140
- state: 'success' | 'done';
140
+ state: "success" | "done";
141
141
  }>;
142
142
  private thumbAborter;
143
143
  private thumbFinder;
@@ -102,6 +102,23 @@ export declare class Compositor extends EventEmitter<{
102
102
  * @param json The JSON project data
103
103
  */
104
104
  loadFromJSON(json: ProjectJSON): Promise<void>;
105
+ /**
106
+ * Renders the frame at the given time and returns it as a base64-encoded PNG.
107
+ *
108
+ * Initialises the internal Pixi application on demand (if not already
109
+ * initialised), performs a single-frame render using the same sprite
110
+ * pipeline as {@link output}, and returns the result without modifying
111
+ * the compositor's encoding state.
112
+ *
113
+ * @param timeMs Time in milliseconds
114
+ * @returns Base64 data-URL string (e.g. "data:image/png;base64,...")
115
+ *
116
+ * @example
117
+ * const compositor = new Compositor({ width: 1280, height: 720 });
118
+ * await compositor.addSprite(videoClip);
119
+ * const frame = await compositor.renderFrame(2000); // frame at 2 s
120
+ */
121
+ renderFrame(timeMs: number): Promise<string>;
105
122
  }
106
123
  /**
107
124
  * Buffer input data and convert to AudioData with fixed frame count
@@ -1030,3 +1030,4 @@ export declare const CHROMA_KEY_UNIFORMS: {
1030
1030
  type: string;
1031
1031
  };
1032
1032
  };
1033
+ export declare const SELECTIVE_HSL_FRAGMENT = "\nin vec2 vTextureCoord;\nin vec4 vColor;\nuniform sampler2D uTexture;\nout vec4 finalColor;\n\nuniform vec3 uTargetColor;\nuniform float uHueShift;\nuniform float uSatShift;\nuniform float uLightShift;\nuniform float uTolerance;\nuniform float uSoftness;\n\nvec3 rgb2hsl(vec3 c) {\n float maxc = max(max(c.r, c.g), c.b);\n float minc = min(min(c.r, c.g), c.b);\n float h = 0.0;\n float s = 0.0;\n float l = (maxc + minc) * 0.5;\n\n float d = maxc - minc;\n if (d > 0.00001) {\n s = l > 0.5 ? d / (2.0 - maxc - minc) : d / (maxc + minc);\n if (maxc == c.r) {\n h = (c.g - c.b) / d + (c.g < c.b ? 6.0 : 0.0);\n } else if (maxc == c.g) {\n h = (c.b - c.r) / d + 2.0;\n } else {\n h = (c.r - c.g) / d + 4.0;\n }\n h /= 6.0;\n }\n return vec3(h, s, l);\n}\n\nfloat hue2rgb(float p, float q, float t) {\n if (t < 0.0) t += 1.0;\n if (t > 1.0) t -= 1.0;\n if (t < 1.0 / 6.0) return p + (q - p) * 6.0 * t;\n if (t < 1.0 / 2.0) return q;\n if (t < 2.0 / 3.0) return p + (q - p) * (2.0 / 3.0 - t) * 6.0;\n return p;\n}\n\nvec3 hsl2rgb(vec3 hsl) {\n float h = hsl.x;\n float s = hsl.y;\n float l = hsl.z;\n if (s <= 0.00001) return vec3(l);\n float q = l < 0.5 ? l * (1.0 + s) : l + s - l * s;\n float p = 2.0 * l - q;\n return vec3(\n hue2rgb(p, q, h + 1.0 / 3.0),\n hue2rgb(p, q, h),\n hue2rgb(p, q, h - 1.0 / 3.0)\n );\n}\n\nvoid main() {\n vec4 src = texture(uTexture, vTextureCoord);\n float dist = distance(src.rgb, uTargetColor);\n float mask = 1.0 - smoothstep(uTolerance, uTolerance + uSoftness, dist);\n\n vec3 hsl = rgb2hsl(src.rgb);\n hsl.x = mod(hsl.x + (uHueShift / 360.0), 1.0);\n hsl.y = clamp(hsl.y + uSatShift, 0.0, 1.0);\n hsl.z = clamp(hsl.z + uLightShift, 0.0, 1.0);\n vec3 adjusted = hsl2rgb(hsl);\n\n vec3 resultColor = mix(src.rgb, adjusted, mask);\n finalColor = vec4(resultColor, src.a);\n}\n";