openvideo 0.2.16 → 0.2.18
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/{browserAll-B3JM-tAA.js → browserAll-C8CHW66V.js} +2 -2
- package/dist/clips/base-clip.d.ts +4 -0
- package/dist/clips/caption-clip.d.ts +43 -43
- package/dist/clips/iclip.d.ts +9 -0
- package/dist/clips/image-clip.d.ts +1 -0
- package/dist/clips/video-clip.d.ts +1 -0
- package/dist/compositor.d.ts +17 -0
- package/dist/effect/glsl/custom-glsl.d.ts +1 -0
- package/dist/{index-T-Me9eJ5.js → index-hudXPK2u.js} +10443 -10058
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +412 -340
- package/dist/json-serialization.d.ts +3 -0
- package/dist/sprite/base-sprite.d.ts +2 -0
- package/dist/sprite/pixi-sprite-renderer.d.ts +1 -0
- package/dist/studio.d.ts +17 -0
- package/dist/utils/color-adjustment.d.ts +53 -0
- package/dist/{webworkerAll-CkYxS0eA.js → webworkerAll-DHuq-MZm.js} +1 -1
- package/package.json +1 -1
|
@@ -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-
|
|
2
|
-
import "./webworkerAll-
|
|
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-hudXPK2u.js";
|
|
2
|
+
import "./webworkerAll-DHuq-MZm.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?:
|
|
8
|
-
textAlign?:
|
|
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[
|
|
20
|
-
align?: ICaptionOpts[
|
|
21
|
-
textCase?: ICaptionOpts[
|
|
22
|
-
verticalAlign?: ICaptionOpts[
|
|
23
|
-
wordsPerLine?: ICaptionOpts[
|
|
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[
|
|
50
|
-
fill: ICaptionOpts[
|
|
51
|
-
align: ICaptionOpts[
|
|
52
|
-
textCase: ICaptionOpts[
|
|
53
|
-
stroke: ICaptionOpts[
|
|
54
|
-
dropShadow: ICaptionOpts[
|
|
55
|
-
caption: ICaptionOpts[
|
|
56
|
-
wordsPerLine: ICaptionOpts[
|
|
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:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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[
|
|
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():
|
|
290
|
-
set wordsPerLine(v:
|
|
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():
|
|
300
|
-
set fontStyle(v:
|
|
301
|
-
get fill(): ICaptionOpts[
|
|
302
|
-
set fill(v: ICaptionOpts[
|
|
303
|
-
get align():
|
|
304
|
-
set align(v:
|
|
305
|
-
get stroke(): ICaptionOpts[
|
|
306
|
-
set stroke(v: ICaptionOpts[
|
|
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[
|
|
310
|
-
set dropShadow(v: ICaptionOpts[
|
|
311
|
-
get caption(): ICaptionOpts[
|
|
312
|
-
set caption(v: ICaptionOpts[
|
|
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:
|
|
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[
|
|
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[
|
|
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[
|
|
381
|
+
setRenderer(renderer: Application['renderer']): void;
|
|
382
382
|
private getRenderer;
|
|
383
383
|
tick(time: number): Promise<{
|
|
384
384
|
video: ImageBitmap;
|
|
385
|
-
state:
|
|
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<
|
|
409
|
+
getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
|
|
410
410
|
private drawRoundedTiktokPath;
|
|
411
411
|
}
|
package/dist/clips/iclip.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -57,6 +57,7 @@ export declare class Image extends BaseClip implements IClip {
|
|
|
57
57
|
startTime: number;
|
|
58
58
|
duration: number;
|
|
59
59
|
}>;
|
|
60
|
+
getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
|
|
60
61
|
/**
|
|
61
62
|
* Load an image clip from a URL using PixiJS Assets
|
|
62
63
|
* This is optimized for Studio as it uses Texture directly
|
|
@@ -102,6 +102,7 @@ export declare class Video extends BaseClip implements IPlaybackCapable {
|
|
|
102
102
|
startTime: number;
|
|
103
103
|
duration: number;
|
|
104
104
|
}>;
|
|
105
|
+
getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
|
|
105
106
|
/**
|
|
106
107
|
* Load a video clip from a URL
|
|
107
108
|
* @param url Video URL
|
package/dist/compositor.d.ts
CHANGED
|
@@ -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";
|