@rendley/sdk 1.0.1
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/LICENSE +48 -0
- package/README.md +40 -0
- package/dist/Engine.d.ts +118 -0
- package/dist/config/config.d.ts +6 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -0
- package/dist/libs/ffmpeg/classes.d.ts +201 -0
- package/dist/libs/ffmpeg/config.d.ts +2 -0
- package/dist/libs/ffmpeg/const.d.ts +37 -0
- package/dist/libs/ffmpeg/empty.d.mts +3 -0
- package/dist/libs/ffmpeg/errors.d.ts +4 -0
- package/dist/libs/ffmpeg/fetchFile.d.ts +1 -0
- package/dist/libs/ffmpeg/index.d.ts +1 -0
- package/dist/libs/ffmpeg/types.d.ts +175 -0
- package/dist/libs/ffmpeg/utils.d.ts +4 -0
- package/dist/libs/ffmpeg/worker.d.ts +10 -0
- package/dist/modules/clip/Clip.d.ts +206 -0
- package/dist/modules/clip/ClipStyle.d.ts +92 -0
- package/dist/modules/clip/clips/audio/AudioClip.d.ts +36 -0
- package/dist/modules/clip/clips/gif/GifClip.d.ts +27 -0
- package/dist/modules/clip/clips/image/ImageClip.d.ts +16 -0
- package/dist/modules/clip/clips/index.d.ts +4 -0
- package/dist/modules/clip/clips/shape/ShapeClip.d.ts +43 -0
- package/dist/modules/clip/clips/shape/ShapeSprite.d.ts +9 -0
- package/dist/modules/clip/clips/shape/ShapeStyle.d.ts +27 -0
- package/dist/modules/clip/clips/text/TextClip.d.ts +42 -0
- package/dist/modules/clip/clips/text/TextSprite.d.ts +7 -0
- package/dist/modules/clip/clips/text/TextStyle.d.ts +69 -0
- package/dist/modules/clip/clips/video/VideoClip.d.ts +48 -0
- package/dist/modules/clip/index.d.ts +2 -0
- package/dist/modules/clip/utils/generateRawData.d.ts +1 -0
- package/dist/modules/display/Display.d.ts +42 -0
- package/dist/modules/display/index.d.ts +1 -0
- package/dist/modules/display/renderer/PixiRenderer.d.ts +16 -0
- package/dist/modules/display/utils/WebCodecsVideoFrameResource.d.ts +7 -0
- package/dist/modules/display/utils/registerSelectionEvents.d.ts +12 -0
- package/dist/modules/event-emitter/EventEmitter.d.ts +4 -0
- package/dist/modules/event-emitter/index.d.ts +2 -0
- package/dist/modules/event-emitter/types/EventEmitter.types.d.ts +179 -0
- package/dist/modules/ffmpeg/FFmpeg.d.ts +11 -0
- package/dist/modules/ffmpeg/types/FFmpeg.types.d.ts +32 -0
- package/dist/modules/filter/Effect.d.ts +36 -0
- package/dist/modules/filter/Filter.d.ts +52 -0
- package/dist/modules/filter/effects/OldFilmEffect.d.ts +2 -0
- package/dist/modules/filter/effects/WaveEffect.d.ts +2 -0
- package/dist/modules/filter/filters/VintageFilter.d.ts +2 -0
- package/dist/modules/filter/index.d.ts +2 -0
- package/dist/modules/filter/utils/removeShaderNameLine.d.ts +1 -0
- package/dist/modules/font-registry/FontRegistry.d.ts +22 -0
- package/dist/modules/font-registry/index.d.ts +1 -0
- package/dist/modules/layer/Layer.d.ts +278 -0
- package/dist/modules/layer/index.d.ts +1 -0
- package/dist/modules/library/Library.d.ts +117 -0
- package/dist/modules/library/MediaData.d.ts +50 -0
- package/dist/modules/library/Subtitles.d.ts +71 -0
- package/dist/modules/library/index.d.ts +1 -0
- package/dist/modules/library/types/MediaData.types.d.ts +7 -0
- package/dist/modules/subtitleManager/SubtitleManager.d.ts +9 -0
- package/dist/modules/subtitleManager/index.d.ts +1 -0
- package/dist/modules/timeline/Timeline.d.ts +372 -0
- package/dist/modules/timeline/index.d.ts +1 -0
- package/dist/modules/transition/Transition.d.ts +76 -0
- package/dist/modules/transition/index.d.ts +1 -0
- package/dist/types/clip.types.d.ts +18 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/browser/getIosVersion.d.ts +1 -0
- package/dist/utils/browser/isIos.d.ts +1 -0
- package/dist/utils/browser/isIosSafari.d.ts +1 -0
- package/dist/utils/color/getSolidColorFromGradient.d.ts +1 -0
- package/dist/utils/color/parseGradient.d.ts +7 -0
- package/dist/utils/core/emitEvent.d.ts +4 -0
- package/dist/utils/file/fileToArrayBuffer.d.ts +1 -0
- package/dist/utils/file/getFilenameFromResponse.d.ts +1 -0
- package/dist/utils/file/toBlobURL.d.ts +1 -0
- package/dist/utils/log.d.ts +7 -0
- package/dist/utils/math/calculateFitScale.d.ts +1 -0
- package/dist/utils/math/clampValue.d.ts +1 -0
- package/dist/utils/texture/createGradientTexture.d.ts +2 -0
- package/package.json +75 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { DemuxerPacket, FFFSMountOptions, FFFSPath, FFFSType, FFMessageFrameData, FFMessageLoadConfig, FFMessageRenderSettings, FileData, FSNode, IsFirst, LogEventCallback, OK, ProgressEventCallback, FFMessageMuxerData, FFMessageInitMuxerData, FFMessageAuthentificateData } from './types';
|
|
2
|
+
import { MediaInfo } from '../../modules/ffmpeg/types/FFmpeg.types';
|
|
3
|
+
type FFMessageOptions = {
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Provides APIs to interact with ffmpeg web worker.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const ffmpeg = new FFmpeg();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare class FFmpeg {
|
|
15
|
+
#private;
|
|
16
|
+
loaded: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Listen to log or prgress events from `ffmpeg.exec()`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* ffmpeg.on("log", ({ type, message }) => {
|
|
23
|
+
* // ...
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* ffmpeg.on("progress", ({ progress, time }) => {
|
|
30
|
+
* // ...
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* - log includes output to stdout and stderr.
|
|
36
|
+
* - The progress events are accurate only when the length of
|
|
37
|
+
* input and output video/audio file are the same.
|
|
38
|
+
*
|
|
39
|
+
* @category FFmpeg
|
|
40
|
+
*/
|
|
41
|
+
on(event: 'log', callback: LogEventCallback): void;
|
|
42
|
+
on(event: 'progress', callback: ProgressEventCallback): void;
|
|
43
|
+
/**
|
|
44
|
+
* Unlisten to log or prgress events from `ffmpeg.exec()`.
|
|
45
|
+
*
|
|
46
|
+
* @category FFmpeg
|
|
47
|
+
*/
|
|
48
|
+
off(event: 'log', callback: LogEventCallback): void;
|
|
49
|
+
off(event: 'progress', callback: ProgressEventCallback): void;
|
|
50
|
+
/**
|
|
51
|
+
* Loads ffmpeg-core inside web worker. It is required to call this method first
|
|
52
|
+
* as it initializes WebAssembly and other essential variables.
|
|
53
|
+
*
|
|
54
|
+
* @category FFmpeg
|
|
55
|
+
* @returns `true` if ffmpeg core is loaded for the first time.
|
|
56
|
+
*/
|
|
57
|
+
load: (config: FFMessageLoadConfig, { signal }?: FFMessageOptions) => Promise<IsFirst>;
|
|
58
|
+
/**
|
|
59
|
+
* Execute ffmpeg command.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* To avoid common I/O issues, ["-nostdin", "-y"] are prepended to the args
|
|
63
|
+
* by default.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const ffmpeg = new FFmpeg();
|
|
68
|
+
* await ffmpeg.load();
|
|
69
|
+
* await ffmpeg.writeFile("video.avi", ...);
|
|
70
|
+
* // ffmpeg -i video.avi video.mp4
|
|
71
|
+
* await ffmpeg.exec(["-i", "video.avi", "video.mp4"]);
|
|
72
|
+
* const data = ffmpeg.readFile("video.mp4");
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @returns `0` if no error, `!= 0` if timeout (1) or error.
|
|
76
|
+
* @category FFmpeg
|
|
77
|
+
*/
|
|
78
|
+
exec: (args: string[], timeout?: number, { signal }?: FFMessageOptions) => Promise<number>;
|
|
79
|
+
/**
|
|
80
|
+
* Terminate all ongoing API calls and terminate web worker.
|
|
81
|
+
* `FFmpeg.load()` must be called again before calling any other APIs.
|
|
82
|
+
*
|
|
83
|
+
* @category FFmpeg
|
|
84
|
+
*/
|
|
85
|
+
terminate: () => void;
|
|
86
|
+
/**
|
|
87
|
+
* Write data to ffmpeg.wasm.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const ffmpeg = new FFmpeg();
|
|
92
|
+
* await ffmpeg.load();
|
|
93
|
+
* await ffmpeg.writeFile("video.avi", await fetchFile("../video.avi"));
|
|
94
|
+
* await ffmpeg.writeFile("text.txt", "hello world");
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @category File System
|
|
98
|
+
*/
|
|
99
|
+
writeFile: (path: string, data: FileData, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
100
|
+
mount: (fsType: FFFSType, options: FFFSMountOptions, mountPoint: FFFSPath) => Promise<OK>;
|
|
101
|
+
unmount: (mountPoint: FFFSPath) => Promise<OK>;
|
|
102
|
+
/**
|
|
103
|
+
* Read data from ffmpeg.wasm.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* const ffmpeg = new FFmpeg();
|
|
108
|
+
* await ffmpeg.load();
|
|
109
|
+
* const data = await ffmpeg.readFile("video.mp4");
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @category File System
|
|
113
|
+
*/
|
|
114
|
+
readFile: (path: string, encoding?: string, { signal }?: FFMessageOptions) => Promise<FileData>;
|
|
115
|
+
/**
|
|
116
|
+
* Delete a file.
|
|
117
|
+
*
|
|
118
|
+
* @category File System
|
|
119
|
+
*/
|
|
120
|
+
deleteFile: (path: string, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
121
|
+
/**
|
|
122
|
+
* Rename a file or directory.
|
|
123
|
+
*
|
|
124
|
+
* @category File System
|
|
125
|
+
*/
|
|
126
|
+
rename: (oldPath: string, newPath: string, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
127
|
+
/**
|
|
128
|
+
* Create a directory.
|
|
129
|
+
*
|
|
130
|
+
* @category File System
|
|
131
|
+
*/
|
|
132
|
+
createDir: (path: string, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
133
|
+
/**
|
|
134
|
+
* List directory contents.
|
|
135
|
+
*
|
|
136
|
+
* @category File System
|
|
137
|
+
*/
|
|
138
|
+
listDir: (path: string, { signal }?: FFMessageOptions) => Promise<FSNode[]>;
|
|
139
|
+
/**
|
|
140
|
+
* Delete an empty directory.
|
|
141
|
+
*
|
|
142
|
+
* @category File System
|
|
143
|
+
*/
|
|
144
|
+
deleteDir: (path: string, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
145
|
+
prepareRenderer: (settings: FFMessageRenderSettings, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
146
|
+
addFrameToRenderer: ({ data }: FFMessageFrameData, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
147
|
+
cancelRenderer: ({ signal }?: FFMessageOptions) => Promise<OK>;
|
|
148
|
+
finalizeRenderer: ({ signal }?: FFMessageOptions) => Promise<OK>;
|
|
149
|
+
initDemuxer: (id: string, path: string, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
150
|
+
closeDemuxer: (id: string, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
151
|
+
seekDemuxer: (id: string, time: number, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
152
|
+
getNextPacketDemuxer: (id: string, { signal }?: FFMessageOptions) => Promise<DemuxerPacket | undefined>;
|
|
153
|
+
initMuxer: (initSettings: FFMessageInitMuxerData, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
154
|
+
addChunkMuxer: (data: FFMessageMuxerData, { signal }?: FFMessageOptions) => Promise<OK>;
|
|
155
|
+
closeMuxer: ({ signal }?: FFMessageOptions) => Promise<OK>;
|
|
156
|
+
authentificate: (data: FFMessageAuthentificateData, { signal }?: FFMessageOptions) => Promise<number>;
|
|
157
|
+
isAuthenticated: () => Promise<boolean>;
|
|
158
|
+
getAuthStatus: () => Promise<number>;
|
|
159
|
+
getAuthSecondsRemaining: () => Promise<number>;
|
|
160
|
+
getSettings: () => Promise<OK>;
|
|
161
|
+
/**
|
|
162
|
+
* Gets information about a media file.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* const ffmpeg = new FFmpeg();
|
|
167
|
+
* await ffmpeg.load();
|
|
168
|
+
* await ffmpeg.writeFile("video.avi", ...);
|
|
169
|
+
* const info = await ffmpeg.getMediaInfo("video.mp4");
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* @returns an object with the following properties:
|
|
173
|
+
* - status: 'success' | 'error' (in case of error another property will be present 'error' with the error string)
|
|
174
|
+
* - path: the path of the media file
|
|
175
|
+
* - duration: the duration in seconds
|
|
176
|
+
* - format: the format of the media file
|
|
177
|
+
* - averageFps: the average fps of all the video streams
|
|
178
|
+
* - streamCount: the number of streams
|
|
179
|
+
* - streams: an array of objects with the following properties:
|
|
180
|
+
* - index: the index of the stream
|
|
181
|
+
* - codec: the codec of the stream
|
|
182
|
+
* - type: 'video' | 'audio' | 'image' | 'gif' | 'subtitle' | 'data' | 'attachment' | 'unknown'
|
|
183
|
+
* - format: the format of the stream
|
|
184
|
+
* - duration: the duration in seconds
|
|
185
|
+
* - bitrate: the bitrate in bits per second
|
|
186
|
+
* - startTime: the start time in seconds
|
|
187
|
+
* In case of videos:
|
|
188
|
+
* - width: the width of the video
|
|
189
|
+
* - height: the height of the video
|
|
190
|
+
* - rotation: the rotation of the video
|
|
191
|
+
* - averageFps: the average fps of the video
|
|
192
|
+
* - frameCount: the number of frames in the video
|
|
193
|
+
* In case of audio:
|
|
194
|
+
* - sampleRate: the sample rate of the audio
|
|
195
|
+
* - channelCount: the number of channels in the audio
|
|
196
|
+
* @category FFmpeg
|
|
197
|
+
*/
|
|
198
|
+
getMediaInfo: (path: string, { signal }?: FFMessageOptions) => Promise<MediaInfo>;
|
|
199
|
+
getMediaSubtitles: (path: string, { signal }?: FFMessageOptions) => Promise<string>;
|
|
200
|
+
}
|
|
201
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const MIME_TYPE_JAVASCRIPT = "text/javascript";
|
|
2
|
+
export declare const MIME_TYPE_WASM = "application/wasm";
|
|
3
|
+
export declare const CORE_URL: string;
|
|
4
|
+
export declare enum FFMessageType {
|
|
5
|
+
LOAD = "LOAD",
|
|
6
|
+
EXEC = "EXEC",
|
|
7
|
+
WRITE_FILE = "WRITE_FILE",
|
|
8
|
+
READ_FILE = "READ_FILE",
|
|
9
|
+
DELETE_FILE = "DELETE_FILE",
|
|
10
|
+
RENAME = "RENAME",
|
|
11
|
+
CREATE_DIR = "CREATE_DIR",
|
|
12
|
+
LIST_DIR = "LIST_DIR",
|
|
13
|
+
DELETE_DIR = "DELETE_DIR",
|
|
14
|
+
ERROR = "ERROR",
|
|
15
|
+
DOWNLOAD = "DOWNLOAD",
|
|
16
|
+
PROGRESS = "PROGRESS",
|
|
17
|
+
LOG = "LOG",
|
|
18
|
+
MOUNT = "MOUNT",
|
|
19
|
+
UNMOUNT = "UNMOUNT",
|
|
20
|
+
RENDER_PREPARE = "RENDER_PREPARE",
|
|
21
|
+
RENDER_CANCEL = "RENDER_CANCEL",
|
|
22
|
+
RENDER_FINALIZE = "RENDER_FINALIZE",
|
|
23
|
+
RENDER_ADDFRAME = "RENDER_ADDFRAME",
|
|
24
|
+
GET_INFO = "GET_INFO",
|
|
25
|
+
GET_SUBTITLES = "GET_SUBTITLES",
|
|
26
|
+
DEMUXER_INIT = "DEMUXER_INIT",
|
|
27
|
+
DEMUXER_SEEK = "DEMUXER_SEEK",
|
|
28
|
+
DEMUXER_CLOSE = "DEMUXER_CLOSE",
|
|
29
|
+
DEMUXER_GETPACKET = "DEMUXER_GETPACKET",
|
|
30
|
+
MUXER_INIT = "MUXER_INIT",
|
|
31
|
+
MUXER_ADDVIDEOCHUNK = "MUXER_ADDVIDEOCHUNK",
|
|
32
|
+
MUXER_CLOSE = "MUXER_FINALIZE",
|
|
33
|
+
AUTH_AUTHENTICATE = "AUTHENTICATE",
|
|
34
|
+
AUTH_GETSTATUS = "AUTH_STATUS",
|
|
35
|
+
AUTH_GETSECONDS = "AUTH_GETSECONDS",
|
|
36
|
+
AUTH_ISAUTHENTICATED = "AUTH_ISAUTHENTICATED"
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchFile: (file?: string | File | Blob) => Promise<Uint8Array>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./classes";
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
export type FFFSPath = string;
|
|
2
|
+
export type FFmpegCoreModule = any;
|
|
3
|
+
export type FFmpegCoreModuleFactory = any;
|
|
4
|
+
/**
|
|
5
|
+
* ffmpeg-core loading configuration.
|
|
6
|
+
*/
|
|
7
|
+
export interface FFMessageLoadConfig {
|
|
8
|
+
/**
|
|
9
|
+
* `ffmpeg-core.js` URL.
|
|
10
|
+
*
|
|
11
|
+
* @defaultValue `https://unpkg.com/@ffmpeg/core@${CORE_VERSION}/dist/umd/ffmpeg-core.js`;
|
|
12
|
+
*/
|
|
13
|
+
coreURL: string;
|
|
14
|
+
/**
|
|
15
|
+
* `ffmpeg-core.wasm` URL.
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue `https://unpkg.com/@ffmpeg/core@${CORE_VERSION}/dist/umd/ffmpeg-core.wasm`;
|
|
18
|
+
*/
|
|
19
|
+
wasmURL: string;
|
|
20
|
+
/**
|
|
21
|
+
* `ffmpeg-core.worker.js` URL.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue `https://unpkg.com/@ffmpeg/core-mt@${CORE_VERSION}/dist/umd/ffmpeg-core.worker.js`;
|
|
24
|
+
*/
|
|
25
|
+
workerURL?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface FFMessageRenderSettings {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
framerate: number;
|
|
31
|
+
outputPath?: string;
|
|
32
|
+
hasAlpha?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface FFMessageFrameData {
|
|
35
|
+
data: Uint8Array;
|
|
36
|
+
}
|
|
37
|
+
export interface FFMessageInitDemuxerData {
|
|
38
|
+
id: string;
|
|
39
|
+
path: FFFSPath;
|
|
40
|
+
}
|
|
41
|
+
export interface FFMessageSeekDemuxerData {
|
|
42
|
+
id: string;
|
|
43
|
+
time: number;
|
|
44
|
+
}
|
|
45
|
+
export interface FFMessageIdDemuxerData {
|
|
46
|
+
id: string;
|
|
47
|
+
}
|
|
48
|
+
export interface FFMessageMuxerData {
|
|
49
|
+
packet: Uint8Array;
|
|
50
|
+
timestamp: bigint;
|
|
51
|
+
duration: bigint;
|
|
52
|
+
isKeyFrame: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface FFMessageInitMuxerData {
|
|
55
|
+
path: FFFSPath;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
framerate: number;
|
|
59
|
+
codec: string;
|
|
60
|
+
}
|
|
61
|
+
export interface FFMessageExecData {
|
|
62
|
+
args: string[];
|
|
63
|
+
timeout?: number;
|
|
64
|
+
}
|
|
65
|
+
export interface FFMessageWriteFileData {
|
|
66
|
+
path: FFFSPath;
|
|
67
|
+
data: FileData;
|
|
68
|
+
}
|
|
69
|
+
export interface FFMessageReadFileData {
|
|
70
|
+
path: FFFSPath;
|
|
71
|
+
encoding: string;
|
|
72
|
+
}
|
|
73
|
+
export interface FFMessageDeleteFileData {
|
|
74
|
+
path: FFFSPath;
|
|
75
|
+
}
|
|
76
|
+
export interface FFMessageRenameData {
|
|
77
|
+
oldPath: FFFSPath;
|
|
78
|
+
newPath: FFFSPath;
|
|
79
|
+
}
|
|
80
|
+
export interface FFMessageCreateDirData {
|
|
81
|
+
path: FFFSPath;
|
|
82
|
+
}
|
|
83
|
+
export interface FFMessageListDirData {
|
|
84
|
+
path: FFFSPath;
|
|
85
|
+
}
|
|
86
|
+
export interface FFMessageGetInfoData {
|
|
87
|
+
path: FFFSPath;
|
|
88
|
+
}
|
|
89
|
+
export interface FFMessageGetSubtitlesData {
|
|
90
|
+
path: FFFSPath;
|
|
91
|
+
}
|
|
92
|
+
export interface FFMessageAuthentificateData {
|
|
93
|
+
licensee: string;
|
|
94
|
+
key: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* @remarks
|
|
98
|
+
* Only deletes empty directory.
|
|
99
|
+
*/
|
|
100
|
+
export interface FFMessageDeleteDirData {
|
|
101
|
+
path: FFFSPath;
|
|
102
|
+
}
|
|
103
|
+
export declare enum FFFSType {
|
|
104
|
+
MEMFS = "MEMFS",
|
|
105
|
+
NODEFS = "NODEFS",
|
|
106
|
+
NODERAWFS = "NODERAWFS",
|
|
107
|
+
IDBFS = "IDBFS",
|
|
108
|
+
WORKERFS = "WORKERFS",
|
|
109
|
+
PROXYFS = "PROXYFS"
|
|
110
|
+
}
|
|
111
|
+
export type WorkerFSFileEntry = File;
|
|
112
|
+
export interface WorkerFSBlobEntry {
|
|
113
|
+
name: string;
|
|
114
|
+
data: Blob;
|
|
115
|
+
}
|
|
116
|
+
export interface WorkerFSMountData {
|
|
117
|
+
blobs?: WorkerFSBlobEntry[];
|
|
118
|
+
files?: WorkerFSFileEntry[];
|
|
119
|
+
}
|
|
120
|
+
export type FFFSMountOptions = WorkerFSMountData;
|
|
121
|
+
export interface FFMessageMountData {
|
|
122
|
+
fsType: FFFSType;
|
|
123
|
+
options: FFFSMountOptions;
|
|
124
|
+
mountPoint: FFFSPath;
|
|
125
|
+
}
|
|
126
|
+
export interface FFMessageUnmountData {
|
|
127
|
+
mountPoint: FFFSPath;
|
|
128
|
+
}
|
|
129
|
+
export type FFMessageData = FFMessageLoadConfig | FFMessageExecData | FFMessageWriteFileData | FFMessageReadFileData | FFMessageDeleteFileData | FFMessageRenameData | FFMessageCreateDirData | FFMessageListDirData | FFMessageDeleteDirData | FFMessageMountData | FFMessageUnmountData | FFMessageGetInfoData | FFMessageGetSubtitlesData | FFMessageFrameData | FFMessageRenderSettings | FFMessageInitDemuxerData | FFMessageSeekDemuxerData | FFMessageIdDemuxerData | FFMessageMuxerData | FFMessageAuthentificateData;
|
|
130
|
+
export interface Message {
|
|
131
|
+
type: string;
|
|
132
|
+
data?: FFMessageData;
|
|
133
|
+
}
|
|
134
|
+
export interface FFMessage extends Message {
|
|
135
|
+
id: number;
|
|
136
|
+
}
|
|
137
|
+
export interface FFMessageEvent extends MessageEvent {
|
|
138
|
+
data: FFMessage;
|
|
139
|
+
}
|
|
140
|
+
export interface LogEvent {
|
|
141
|
+
type: string;
|
|
142
|
+
message: string;
|
|
143
|
+
}
|
|
144
|
+
export interface ProgressEvent {
|
|
145
|
+
progress: number;
|
|
146
|
+
time: number;
|
|
147
|
+
}
|
|
148
|
+
export interface DemuxerPacket {
|
|
149
|
+
packet: Uint8Array;
|
|
150
|
+
isKeyFrame: boolean;
|
|
151
|
+
timestamp: bigint;
|
|
152
|
+
duration: bigint;
|
|
153
|
+
}
|
|
154
|
+
export type ExitCode = number;
|
|
155
|
+
export type ErrorMessage = string;
|
|
156
|
+
export type FileData = Uint8Array | string;
|
|
157
|
+
export type IsFirst = boolean;
|
|
158
|
+
export type OK = boolean;
|
|
159
|
+
export interface FSNode {
|
|
160
|
+
name: string;
|
|
161
|
+
isDir: boolean;
|
|
162
|
+
}
|
|
163
|
+
export type CallbackData = FileData | ExitCode | ErrorMessage | LogEvent | ProgressEvent | IsFirst | OK | Error | FSNode[] | undefined | object;
|
|
164
|
+
export interface Callbacks {
|
|
165
|
+
[id: number | string]: (data: CallbackData) => void;
|
|
166
|
+
}
|
|
167
|
+
export type LogEventCallback = (event: LogEvent) => void;
|
|
168
|
+
export type ProgressEventCallback = (event: ProgressEvent) => void;
|
|
169
|
+
export interface FFMessageEventCallback {
|
|
170
|
+
data: {
|
|
171
|
+
id: number;
|
|
172
|
+
type: string;
|
|
173
|
+
data: CallbackData;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference no-default-lib="true"/>
|
|
2
|
+
/// <reference lib="esnext" />
|
|
3
|
+
/// <reference lib="webworker" />
|
|
4
|
+
/// <reference lib="dom" />
|
|
5
|
+
import type { FFmpegCoreModuleFactory } from './types';
|
|
6
|
+
declare global {
|
|
7
|
+
interface WorkerGlobalScope {
|
|
8
|
+
createFFmpegCore: FFmpegCoreModuleFactory;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ClipStyle } from './ClipStyle';
|
|
4
|
+
import { Effect, Filter } from '../filter';
|
|
5
|
+
import { WarmModeEnum } from '../../types/clip.types';
|
|
6
|
+
export declare enum ClipState {
|
|
7
|
+
Idle = 0,
|
|
8
|
+
Preloading = 1,
|
|
9
|
+
Loaded = 2,
|
|
10
|
+
Offloaded = 3
|
|
11
|
+
}
|
|
12
|
+
export interface ClipOptions<K extends ClipStyle = ClipStyle> {
|
|
13
|
+
mediaDataId?: string;
|
|
14
|
+
subtitlesId?: string;
|
|
15
|
+
subtitlesOffset?: number;
|
|
16
|
+
startTime?: number;
|
|
17
|
+
duration?: number;
|
|
18
|
+
leftTrim?: number;
|
|
19
|
+
rightTrim?: number;
|
|
20
|
+
filters?: Clip['filters'];
|
|
21
|
+
effects?: Clip['effects'];
|
|
22
|
+
style?: Partial<ReturnType<K['serialize']>>;
|
|
23
|
+
}
|
|
24
|
+
export declare const ClipSchema: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
type: z.ZodString;
|
|
28
|
+
mediaDataId: z.ZodOptional<z.ZodString>;
|
|
29
|
+
subtitlesId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
subtitlesOffset: z.ZodNumber;
|
|
31
|
+
startTime: z.ZodNumber;
|
|
32
|
+
duration: z.ZodNumber;
|
|
33
|
+
leftTrim: z.ZodNumber;
|
|
34
|
+
rightTrim: z.ZodNumber;
|
|
35
|
+
filters: z.ZodArray<z.ZodObject<{
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
sourceId: z.ZodString;
|
|
39
|
+
options: z.ZodObject<{
|
|
40
|
+
lutUrl: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
lutUrl: string;
|
|
43
|
+
}, {
|
|
44
|
+
lutUrl: string;
|
|
45
|
+
}>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
name: string;
|
|
48
|
+
options: {
|
|
49
|
+
lutUrl: string;
|
|
50
|
+
};
|
|
51
|
+
id: string;
|
|
52
|
+
sourceId: string;
|
|
53
|
+
}, {
|
|
54
|
+
name: string;
|
|
55
|
+
options: {
|
|
56
|
+
lutUrl: string;
|
|
57
|
+
};
|
|
58
|
+
id: string;
|
|
59
|
+
sourceId: string;
|
|
60
|
+
}>, "many">;
|
|
61
|
+
effects: z.ZodArray<z.ZodUnknown, "many">;
|
|
62
|
+
warpMode: z.ZodNativeEnum<typeof WarmModeEnum>;
|
|
63
|
+
style: z.ZodUnknown;
|
|
64
|
+
text: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
name: string;
|
|
67
|
+
type: string;
|
|
68
|
+
id: string;
|
|
69
|
+
duration: number;
|
|
70
|
+
filters: {
|
|
71
|
+
name: string;
|
|
72
|
+
options: {
|
|
73
|
+
lutUrl: string;
|
|
74
|
+
};
|
|
75
|
+
id: string;
|
|
76
|
+
sourceId: string;
|
|
77
|
+
}[];
|
|
78
|
+
effects: unknown[];
|
|
79
|
+
subtitlesOffset: number;
|
|
80
|
+
startTime: number;
|
|
81
|
+
leftTrim: number;
|
|
82
|
+
rightTrim: number;
|
|
83
|
+
warpMode: WarmModeEnum;
|
|
84
|
+
mediaDataId?: string | undefined;
|
|
85
|
+
subtitlesId?: string | undefined;
|
|
86
|
+
style?: unknown;
|
|
87
|
+
text?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
name: string;
|
|
90
|
+
type: string;
|
|
91
|
+
id: string;
|
|
92
|
+
duration: number;
|
|
93
|
+
filters: {
|
|
94
|
+
name: string;
|
|
95
|
+
options: {
|
|
96
|
+
lutUrl: string;
|
|
97
|
+
};
|
|
98
|
+
id: string;
|
|
99
|
+
sourceId: string;
|
|
100
|
+
}[];
|
|
101
|
+
effects: unknown[];
|
|
102
|
+
subtitlesOffset: number;
|
|
103
|
+
startTime: number;
|
|
104
|
+
leftTrim: number;
|
|
105
|
+
rightTrim: number;
|
|
106
|
+
warpMode: WarmModeEnum;
|
|
107
|
+
mediaDataId?: string | undefined;
|
|
108
|
+
subtitlesId?: string | undefined;
|
|
109
|
+
style?: unknown;
|
|
110
|
+
text?: string | undefined;
|
|
111
|
+
}>;
|
|
112
|
+
export declare class Clip<T extends PIXI.Sprite = PIXI.Sprite, K extends ClipStyle = ClipStyle> {
|
|
113
|
+
id: string;
|
|
114
|
+
protected startTime: number;
|
|
115
|
+
protected duration: number;
|
|
116
|
+
protected leftTrim: number;
|
|
117
|
+
protected rightTrim: number;
|
|
118
|
+
protected filters: Filter[];
|
|
119
|
+
protected effects: Effect[];
|
|
120
|
+
protected warpMode: WarmModeEnum;
|
|
121
|
+
protected isBuffering: boolean;
|
|
122
|
+
protected mediaDataId?: string;
|
|
123
|
+
protected subtitlesId?: string;
|
|
124
|
+
protected subtitlesOffset: number;
|
|
125
|
+
protected type: string;
|
|
126
|
+
protected hasTransition: boolean;
|
|
127
|
+
sprite: T;
|
|
128
|
+
style: K;
|
|
129
|
+
state: ClipState;
|
|
130
|
+
constructor(options: ClipOptions<K>);
|
|
131
|
+
init(layerId: string): void;
|
|
132
|
+
isReady(): boolean;
|
|
133
|
+
getStartTime(): number;
|
|
134
|
+
getEndTime(): number;
|
|
135
|
+
getLeftTrim(): number;
|
|
136
|
+
getRightTrim(): number;
|
|
137
|
+
getLeftBound(): number;
|
|
138
|
+
getRightBound(): number;
|
|
139
|
+
getTrimmedDuration(): number;
|
|
140
|
+
getFilters(): Filter[];
|
|
141
|
+
getEffects(): Effect[];
|
|
142
|
+
moveBy(amount: number): void;
|
|
143
|
+
getType(): string;
|
|
144
|
+
generateNewId(): void;
|
|
145
|
+
setStartTime(startTime: number): void;
|
|
146
|
+
setLeftTrim(trim: number): void;
|
|
147
|
+
setRightTrim(trim: number): void;
|
|
148
|
+
getDuration(): number;
|
|
149
|
+
getFilterById(filterId: string): Filter | undefined;
|
|
150
|
+
getEffectById(effectId: string): Effect | undefined;
|
|
151
|
+
setHasTransition(hasTransition: boolean): void;
|
|
152
|
+
getHasTransition(): boolean;
|
|
153
|
+
getMediaId(): string | undefined;
|
|
154
|
+
getIsProcessing(): boolean;
|
|
155
|
+
addFilter(filter: Filter): void;
|
|
156
|
+
removeFilter(filterId: string): void;
|
|
157
|
+
addEffect(effect: Effect): void;
|
|
158
|
+
removeEffect(effectId: string): void;
|
|
159
|
+
destroy(): void;
|
|
160
|
+
onPlay(currentTime: number): Promise<void>;
|
|
161
|
+
onPause(currentTime: number): void;
|
|
162
|
+
onResize(width: number, height: number): void;
|
|
163
|
+
onRenderStart(): Promise<void>;
|
|
164
|
+
onRenderDone(canceled: boolean): Promise<void>;
|
|
165
|
+
isActive(currentTime: number): boolean;
|
|
166
|
+
updateVisibility(currentTime: number): void;
|
|
167
|
+
setSubtitles(subtitlesId: string, offset: number): void;
|
|
168
|
+
removeSubtitles(): void;
|
|
169
|
+
getSubtitlesId(): string | undefined;
|
|
170
|
+
getSubtitlesOffset(): number;
|
|
171
|
+
setSubtitlesOffset(offset: number): void;
|
|
172
|
+
render(currentTime: number): null;
|
|
173
|
+
private processUpdate;
|
|
174
|
+
getSubtitleText(currentTime: number): string | undefined;
|
|
175
|
+
private updatePIXIFilters;
|
|
176
|
+
update(currentTime: number): void;
|
|
177
|
+
preload(currentTime: number): void;
|
|
178
|
+
offload(): void;
|
|
179
|
+
clone(): Clip<PIXI.Sprite, ClipStyle<PIXI.Sprite>>;
|
|
180
|
+
protected updateTexture(pixels: Uint8Array, width: number, height: number): void;
|
|
181
|
+
serialize(): {
|
|
182
|
+
name: string;
|
|
183
|
+
type: string;
|
|
184
|
+
id: string;
|
|
185
|
+
duration: number;
|
|
186
|
+
filters: {
|
|
187
|
+
name: string;
|
|
188
|
+
options: {
|
|
189
|
+
lutUrl: string;
|
|
190
|
+
};
|
|
191
|
+
id: string;
|
|
192
|
+
sourceId: string;
|
|
193
|
+
}[];
|
|
194
|
+
effects: unknown[];
|
|
195
|
+
subtitlesOffset: number;
|
|
196
|
+
startTime: number;
|
|
197
|
+
leftTrim: number;
|
|
198
|
+
rightTrim: number;
|
|
199
|
+
warpMode: WarmModeEnum;
|
|
200
|
+
mediaDataId?: string | undefined;
|
|
201
|
+
subtitlesId?: string | undefined;
|
|
202
|
+
style?: unknown;
|
|
203
|
+
text?: string | undefined;
|
|
204
|
+
};
|
|
205
|
+
static deserialize(data: object): Clip<PIXI.Sprite, ClipStyle<PIXI.Sprite>>;
|
|
206
|
+
}
|