ugcinc 1.1.1 → 1.1.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.
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export type SegmentType = 'video' | 'image' | 'text' | 'audio' | 'editor';
|
|
2
|
+
export type TimeValue = {
|
|
3
|
+
type: 'absolute';
|
|
4
|
+
value: number;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'relative';
|
|
7
|
+
value: number;
|
|
8
|
+
};
|
|
9
|
+
export interface BaseSegment {
|
|
10
|
+
id: string;
|
|
11
|
+
type: SegmentType;
|
|
12
|
+
source: string;
|
|
13
|
+
order: number;
|
|
14
|
+
offset: TimeValue;
|
|
15
|
+
startTrim: number;
|
|
16
|
+
endTrim: number;
|
|
17
|
+
duration?: TimeValue;
|
|
18
|
+
}
|
|
19
|
+
export interface VisualSegment extends BaseSegment {
|
|
20
|
+
type: 'video' | 'image' | 'text';
|
|
21
|
+
xOffset: number;
|
|
22
|
+
yOffset: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
zIndex: number;
|
|
26
|
+
scale: number;
|
|
27
|
+
rotation: number;
|
|
28
|
+
}
|
|
29
|
+
export interface PictureSegment extends VisualSegment {
|
|
30
|
+
type: 'video' | 'image';
|
|
31
|
+
fit: 'cover' | 'contain' | 'fill';
|
|
32
|
+
speed: number;
|
|
33
|
+
opacity: number;
|
|
34
|
+
}
|
|
35
|
+
export interface VideoSegment extends PictureSegment {
|
|
36
|
+
type: 'video';
|
|
37
|
+
volume: number;
|
|
38
|
+
}
|
|
39
|
+
export interface ImageSegment extends PictureSegment {
|
|
40
|
+
type: 'image';
|
|
41
|
+
loop: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface AudioSegment extends BaseSegment {
|
|
44
|
+
type: 'audio';
|
|
45
|
+
}
|
|
46
|
+
export interface TextSegment extends VisualSegment {
|
|
47
|
+
type: 'text';
|
|
48
|
+
text: string;
|
|
49
|
+
alignment: 'left' | 'center' | 'right' | 'justify';
|
|
50
|
+
verticalAlign: 'top' | 'middle' | 'bottom';
|
|
51
|
+
direction: 'ltr' | 'rtl' | 'auto';
|
|
52
|
+
padding: number;
|
|
53
|
+
fontType: 'arial' | 'tiktok' | 'apple';
|
|
54
|
+
fontSize: number;
|
|
55
|
+
fontWeight: 'normal' | 'bold';
|
|
56
|
+
lineHeight: number;
|
|
57
|
+
letterSpacing: number;
|
|
58
|
+
textWrap: 'word' | 'char' | 'none';
|
|
59
|
+
wordBreak: 'normal' | 'break-word' | 'break-all';
|
|
60
|
+
hyphenation: 'none' | 'auto';
|
|
61
|
+
maxLines: number;
|
|
62
|
+
textOverflow: 'clip' | 'ellipsis';
|
|
63
|
+
ellipsis: string;
|
|
64
|
+
color: string;
|
|
65
|
+
backgroundColor: string;
|
|
66
|
+
strokeColor?: string;
|
|
67
|
+
strokeWidth?: number;
|
|
68
|
+
}
|
|
69
|
+
import type { Editor } from './video';
|
|
70
|
+
export interface EditorSegment extends Omit<VisualSegment, 'type' | 'source'> {
|
|
71
|
+
type: 'editor';
|
|
72
|
+
source: '';
|
|
73
|
+
editor: Editor;
|
|
74
|
+
fit?: 'cover' | 'contain' | 'fill';
|
|
75
|
+
opacity?: number;
|
|
76
|
+
speed?: number;
|
|
77
|
+
volume?: number;
|
|
78
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BaseSegment, EditorSegment } from "./segment";
|
|
2
|
+
export interface Channel {
|
|
3
|
+
id: string;
|
|
4
|
+
segments: Array<BaseSegment | EditorSegment>;
|
|
5
|
+
}
|
|
6
|
+
export interface Editor {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
fps: number;
|
|
11
|
+
channels: Channel[];
|
|
12
|
+
}
|
package/dist/video.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BaseClient } from './base';
|
|
2
|
+
import type { RenderVideoParams, RenderVideoResponse, ApiResponse } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Client for video rendering operations
|
|
5
|
+
*/
|
|
6
|
+
export declare class VideoClient extends BaseClient {
|
|
7
|
+
/**
|
|
8
|
+
* Render a video from an editor configuration
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const result = await client.video.render({
|
|
13
|
+
* editor: {
|
|
14
|
+
* width: 1080,
|
|
15
|
+
* height: 1920,
|
|
16
|
+
* fps: 30,
|
|
17
|
+
* duration: 5000,
|
|
18
|
+
* channels: [
|
|
19
|
+
* {
|
|
20
|
+
* id: "background",
|
|
21
|
+
* segments: [
|
|
22
|
+
* {
|
|
23
|
+
* id: "bg-video",
|
|
24
|
+
* type: "video",
|
|
25
|
+
* source: "https://example.com/video.mp4",
|
|
26
|
+
* order: 0,
|
|
27
|
+
* offset: { type: "absolute", value: 0 },
|
|
28
|
+
* startTrim: 0,
|
|
29
|
+
* endTrim: 0,
|
|
30
|
+
* xOffset: 0,
|
|
31
|
+
* yOffset: 0,
|
|
32
|
+
* width: 1080,
|
|
33
|
+
* height: 1920,
|
|
34
|
+
* zIndex: 0,
|
|
35
|
+
* scale: 1,
|
|
36
|
+
* rotation: 0,
|
|
37
|
+
* fit: "cover",
|
|
38
|
+
* speed: 1,
|
|
39
|
+
* opacity: 100,
|
|
40
|
+
* volume: 50
|
|
41
|
+
* }
|
|
42
|
+
* ]
|
|
43
|
+
* }
|
|
44
|
+
* ]
|
|
45
|
+
* }
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
render(params: RenderVideoParams): Promise<ApiResponse<RenderVideoResponse>>;
|
|
50
|
+
}
|
package/dist/video.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VideoClient = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
/**
|
|
6
|
+
* Client for video rendering operations
|
|
7
|
+
*/
|
|
8
|
+
class VideoClient extends base_1.BaseClient {
|
|
9
|
+
/**
|
|
10
|
+
* Render a video from an editor configuration
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const result = await client.video.render({
|
|
15
|
+
* editor: {
|
|
16
|
+
* width: 1080,
|
|
17
|
+
* height: 1920,
|
|
18
|
+
* fps: 30,
|
|
19
|
+
* duration: 5000,
|
|
20
|
+
* channels: [
|
|
21
|
+
* {
|
|
22
|
+
* id: "background",
|
|
23
|
+
* segments: [
|
|
24
|
+
* {
|
|
25
|
+
* id: "bg-video",
|
|
26
|
+
* type: "video",
|
|
27
|
+
* source: "https://example.com/video.mp4",
|
|
28
|
+
* order: 0,
|
|
29
|
+
* offset: { type: "absolute", value: 0 },
|
|
30
|
+
* startTrim: 0,
|
|
31
|
+
* endTrim: 0,
|
|
32
|
+
* xOffset: 0,
|
|
33
|
+
* yOffset: 0,
|
|
34
|
+
* width: 1080,
|
|
35
|
+
* height: 1920,
|
|
36
|
+
* zIndex: 0,
|
|
37
|
+
* scale: 1,
|
|
38
|
+
* rotation: 0,
|
|
39
|
+
* fit: "cover",
|
|
40
|
+
* speed: 1,
|
|
41
|
+
* opacity: 100,
|
|
42
|
+
* volume: 50
|
|
43
|
+
* }
|
|
44
|
+
* ]
|
|
45
|
+
* }
|
|
46
|
+
* ]
|
|
47
|
+
* }
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
async render(params) {
|
|
52
|
+
return this.post('/video/render', params);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.VideoClient = VideoClient;
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ugcinc",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "TypeScript/JavaScript client for the UGC Inc API",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"prepublishOnly": "npm run build",
|
|
10
|
-
"test": "echo \"No tests specified\" && exit 0"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"ugcinc",
|
|
14
|
-
"api",
|
|
15
|
-
"client",
|
|
16
|
-
"tiktok",
|
|
17
|
-
"automation",
|
|
18
|
-
"social-media",
|
|
19
|
-
"content-management"
|
|
20
|
-
],
|
|
21
|
-
"author": "UGC Inc",
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@types/node": "^20.0.0",
|
|
25
|
-
"typescript": "^5.0.0"
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist",
|
|
30
|
-
"README.md"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "ugcinc",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "TypeScript/JavaScript client for the UGC Inc API",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
10
|
+
"test": "echo \"No tests specified\" && exit 0"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"ugcinc",
|
|
14
|
+
"api",
|
|
15
|
+
"client",
|
|
16
|
+
"tiktok",
|
|
17
|
+
"automation",
|
|
18
|
+
"social-media",
|
|
19
|
+
"content-management"
|
|
20
|
+
],
|
|
21
|
+
"author": "UGC Inc",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^20.0.0",
|
|
25
|
+
"typescript": "^5.0.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
|