@rendley/sdk 1.12.26 → 1.14.0

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.
Files changed (35) hide show
  1. package/dist/Engine.d.ts +104 -2
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +1 -1
  5. package/dist/libs/ffmpeg/classes.d.ts +4 -2
  6. package/dist/libs/ffmpeg/const.d.ts +2 -0
  7. package/dist/libs/ffmpeg/types.d.ts +17 -2
  8. package/dist/modules/clip/clips/adjustment/AdjustmentClip.d.ts +1 -0
  9. package/dist/modules/clip/clips/audio/AudioClip.d.ts +1 -1
  10. package/dist/modules/clip/clips/gif/GifClip.d.ts +1 -0
  11. package/dist/modules/clip/clips/htmlText/HtmlTextClip.d.ts +1 -1
  12. package/dist/modules/clip/clips/lottie/LottieClip.d.ts +1 -1
  13. package/dist/modules/clip/clips/shape/ShapeStyle.d.ts +4 -4
  14. package/dist/modules/clip/clips/text/TextClip.d.ts +1 -1
  15. package/dist/modules/clip/clips/text/TextStyle.d.ts +4 -4
  16. package/dist/modules/clip/clips/video/VideoClip.d.ts +7 -1
  17. package/dist/modules/ffmpeg/FFmpeg.d.ts +1 -0
  18. package/dist/modules/filmstrip-extractor/FilmstripExtractor.d.ts +1 -1
  19. package/dist/modules/filmstrip-extractor/FilmstripExtractor.types.d.ts +2 -1
  20. package/dist/modules/library/EffectData.d.ts +24 -0
  21. package/dist/modules/library/Library.d.ts +64 -0
  22. package/dist/modules/library/MediaData.d.ts +17 -7
  23. package/dist/modules/library/TransitionData.d.ts +24 -0
  24. package/dist/modules/library/types/Property.types.d.ts +12 -0
  25. package/dist/modules/renderer/OutputChunkHelper.d.ts +106 -0
  26. package/dist/modules/renderer/Renderer.d.ts +12 -1
  27. package/dist/modules/renderer/index.d.ts +1 -0
  28. package/dist/modules/settings/Settings.d.ts +24 -0
  29. package/dist/modules/storage/StorageProviderBase.d.ts +1 -1
  30. package/dist/modules/timeline/Timeline.d.ts +1 -0
  31. package/dist/types/hash.types.d.ts +2 -1
  32. package/dist/utils/browser/checkVideoCompatibilityOrTranscode.d.ts +18 -0
  33. package/dist/utils/file/urlToBlobChunks.d.ts +1 -0
  34. package/dist/utils/transcode/transcodeMedia.d.ts +25 -0
  35. package/package.json +1 -1
@@ -43,16 +43,28 @@ export declare const PropertyDescriptionSchema: z.ZodObject<{
43
43
  label: z.ZodOptional<z.ZodString>;
44
44
  description: z.ZodOptional<z.ZodString>;
45
45
  defaultValue: z.ZodType<Required<any>, z.ZodTypeDef, Required<any>>;
46
+ min: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>>;
47
+ max: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>>;
48
+ step: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>>;
49
+ initOnly: z.ZodOptional<z.ZodBoolean>;
46
50
  }, "strip", z.ZodTypeAny, {
47
51
  type: PropertyDescriptionTypeEnum;
48
52
  name: string;
49
53
  defaultValue: Required<any>;
50
54
  label?: string | undefined;
51
55
  description?: string | undefined;
56
+ min?: number | number[] | undefined;
57
+ max?: number | number[] | undefined;
58
+ step?: number | number[] | undefined;
59
+ initOnly?: boolean | undefined;
52
60
  }, {
53
61
  type: PropertyDescriptionTypeEnum;
54
62
  name: string;
55
63
  defaultValue: Required<any>;
56
64
  label?: string | undefined;
57
65
  description?: string | undefined;
66
+ min?: number | number[] | undefined;
67
+ max?: number | number[] | undefined;
68
+ step?: number | number[] | undefined;
69
+ initOnly?: boolean | undefined;
58
70
  }>;
@@ -0,0 +1,106 @@
1
+ export interface OutputChunkFileDesc {
2
+ filename: string;
3
+ path: string;
4
+ chunkId: number;
5
+ }
6
+ export declare class OutputChunkHelper {
7
+ chunks: OutputChunkFileDesc[];
8
+ mimeType: string;
9
+ extension: string;
10
+ constructor(chunks: OutputChunkFileDesc[], mimeType: string, extension: string);
11
+ /**
12
+ * Reads the raw bytes for a chunk by its numeric identifier.
13
+ *
14
+ * Attempts to read the chunk as Uint8Array from the chunkId. If the chunk exists and the read succeeds, the promise resolves to a
15
+ * Uint8Array containing the file bytes. If the chunk is missing or an error occurs
16
+ * during reading, the error is logged and the promise resolves to null.
17
+ *
18
+ * @param chunkId - The numeric identifier (index) of the chunk to read.
19
+ * @returns A promise that resolves to the chunk's bytes as a Uint8Array, or null if the
20
+ * chunk does not exist or could not be read.
21
+ */
22
+ readChunkAsBytes(chunkId: number): Promise<Uint8Array | null>;
23
+ /**
24
+ * Reads the specified chunk and returns it as a Blob.
25
+ *
26
+ * @remarks
27
+ * Not recommended because it will double the memory usage!
28
+ *
29
+ * If the chunk with the given id exists, this method attempts to read its bytes via readChunkBytes
30
+ * and constructs a Blob using the instance's mimeType. If the chunk does not exist or the bytes
31
+ * cannot be read, the promise resolves to null.
32
+ *
33
+ * @param chunkId - Identifier (index) of the chunk to read.
34
+ * @returns A Promise that resolves to a Blob containing the chunk's data, or null if the chunk is missing or unreadable.
35
+ * @throws Propagates any error thrown by readChunkBytes.
36
+ */
37
+ readChunkAsBlob(chunkId: number): Promise<Blob | null>;
38
+ /**
39
+ * Creates an object URL for the specified chunk if it exists.
40
+ *
41
+ * @remarks
42
+ * Not recommended because it will double the memory usage!
43
+ *
44
+ * Attempts to read the chunk as a Blob (via `readChunkAsBlob`) and, if a Blob
45
+ * is obtained, returns a URL created with `URL.createObjectURL(blob)`. If the
46
+ * chunk is not present or cannot be read, the promise resolves to `null`.
47
+ *
48
+ * Note: callers are responsible for revoking the returned URL with
49
+ * `URL.revokeObjectURL` when it is no longer needed to avoid memory leaks.
50
+ *
51
+ * @param chunkId - The identifier (index) of the chunk to read.
52
+ * @returns A `Promise` that resolves to an object URL `string` for the chunk
53
+ * Blob, or `null` if the chunk does not exist or could not be read.
54
+ */
55
+ readChunkAsUrl(chunkId: number): Promise<string | null>;
56
+ /**
57
+ * Reads and merges all chunks into a single Uint8Array.
58
+ *
59
+ * @returns {Promise<Uint8Array | null>} A promise that resolves to a merged Uint8Array containing all chunk data,
60
+ * or null if an error occurs during reading or merging.
61
+ *
62
+ * @throws Does not throw, but logs errors at ERROR level if chunk reading or merging fails.
63
+ *
64
+ * @example
65
+ * const mergedData = await helper.readMergedChunksAsBytes();
66
+ * if (mergedData) {
67
+ * // Process merged chunk data
68
+ * }
69
+ */
70
+ readMergedChunksAsBytes(): Promise<Uint8Array | null>;
71
+ /**
72
+ * Reads merged chunks and converts them to a Blob object.
73
+ * @remarks
74
+ * Not recommended because it will double the memory usage!
75
+ * @returns A promise that resolves to a Blob if chunks are successfully read and merged,
76
+ * or null if no bytes are available.
77
+ */
78
+ readMergedChunksAsBlob(): Promise<Blob | null>;
79
+ /**
80
+ * Reads merged chunks and returns them as a URL object reference.
81
+ * @remarks
82
+ * Not recommended because it will double the memory usage!
83
+ * Don't forget to revoke the URL after usage!
84
+ * @returns A promise that resolves to a blob URL string, or null if no blob data is available.
85
+ */
86
+ readMergedChunksAsUrl(): Promise<string | null>;
87
+ removeChunk(chunkId: number): Promise<void>;
88
+ removeAllChunks(): Promise<void>;
89
+ /**
90
+ * Checks whether the browser supports the File System Access save picker API.
91
+ *
92
+ * @returns `true` when `window.showSaveFilePicker` is available; otherwise `false`.
93
+ */
94
+ isSaveToFileSupported(): boolean;
95
+ /**
96
+ * Prompts the user for a save location and writes all output chunks to the selected file.
97
+ *
98
+ * Uses the File System Access API (`showSaveFilePicker`) and writes each chunk sequentially.
99
+ *
100
+ * @param fileName - Suggested filename shown in the save dialog.
101
+ * @param bufferSize - Reserved chunk step size in bytes. Defaults to `100 * 1024 * 1024` (100 MB).
102
+ * @param progressCallback - Optional callback function to receive progress updates. range [0 - 1]
103
+ * @returns A promise that resolves to `true` when all chunks are written successfully, otherwise `false`.
104
+ */
105
+ browseAndSaveToFile(fileName: string, progressCallback?: ((progress: number) => void) | null, bufferSize?: number): Promise<boolean>;
106
+ }
@@ -1,4 +1,10 @@
1
- import { ExportOptions, ExportResult } from '../../index';
1
+ import { AudioExtensions, ExportOptions, ExportResult, MediaExtensions } from '../../index';
2
+ import { FFmpeg as RootFFmpeg } from '../../libs/ffmpeg';
3
+ declare enum AudioMixResults {
4
+ SUCCESS = "success",
5
+ ERROR = "error",
6
+ NO_OUTPUT = "no_output"
7
+ }
2
8
  export declare class Renderer {
3
9
  private rendering;
4
10
  private isBackgrounded;
@@ -8,6 +14,8 @@ export declare class Renderer {
8
14
  private originalWidth;
9
15
  private originalHeight;
10
16
  private originalResolution;
17
+ private ensureWorkerDir;
18
+ private mountMediaInWorker;
11
19
  constructor();
12
20
  destroy(): void;
13
21
  private visibilityChangeHandler;
@@ -34,4 +42,7 @@ export declare class Renderer {
34
42
  private sleep;
35
43
  render(payload?: ExportOptions): Promise<ExportResult | null>;
36
44
  render_with_frames(payload?: ExportOptions): Promise<ExportResult | null>;
45
+ muxVideo(ffmpeg: RootFFmpeg, mixGenerated: AudioMixResults, extension: MediaExtensions, audioExtension: AudioExtensions, from: number, to: number): Promise<ExportResult>;
46
+ muxChunkedVideo(ffmpeg: RootFFmpeg, mixGenerated: AudioMixResults, extension: MediaExtensions, audioExtension: AudioExtensions, from: number, to: number, outputFiles: string[]): Promise<ExportResult>;
37
47
  }
48
+ export {};
@@ -1 +1,2 @@
1
1
  export * from "./Renderer";
2
+ export * from "./OutputChunkHelper";
@@ -34,6 +34,7 @@ export declare enum MonoMixType {
34
34
  }
35
35
  export declare const SettingsSchema: z.ZodObject<{
36
36
  m3u8MaxResolution: z.ZodDefault<z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
37
+ useInternalTranscoder: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
37
38
  clipAudioStoreSamples: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
38
39
  clipAudioSampleRate: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
39
40
  clipAudioSampleForceMono: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -55,6 +56,8 @@ export declare const SettingsSchema: z.ZodObject<{
55
56
  renderAudioUseWorker: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
56
57
  renderCancelFailTimeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
57
58
  renderVideoUseDirectFrames: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
59
+ renderUseChunkedOutput: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
60
+ renderChunkedOutputMaxSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
58
61
  decoderUseWebCodecs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
59
62
  decoderPreferredAcceleration: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof PreferredAcceleration>>>;
60
63
  decoderUseSeparateWorker: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -76,6 +79,7 @@ export declare const SettingsSchema: z.ZodObject<{
76
79
  mediaHashAlgorithm: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof HashAlgorithmEnum>>>;
77
80
  }, "strip", z.ZodTypeAny, {
78
81
  m3u8MaxResolution: [number, number];
82
+ useInternalTranscoder: boolean;
79
83
  clipAudioStoreSamples: boolean;
80
84
  clipAudioSampleRate: number;
81
85
  clipAudioSampleForceMono: boolean;
@@ -97,6 +101,8 @@ export declare const SettingsSchema: z.ZodObject<{
97
101
  renderAudioUseWorker: boolean;
98
102
  renderCancelFailTimeout: number;
99
103
  renderVideoUseDirectFrames: boolean;
104
+ renderUseChunkedOutput: boolean;
105
+ renderChunkedOutputMaxSize: number;
100
106
  decoderUseWebCodecs: boolean;
101
107
  decoderPreferredAcceleration: PreferredAcceleration;
102
108
  decoderUseSeparateWorker: boolean;
@@ -118,6 +124,7 @@ export declare const SettingsSchema: z.ZodObject<{
118
124
  mediaHashAlgorithm: HashAlgorithmEnum;
119
125
  }, {
120
126
  m3u8MaxResolution?: [number, number] | undefined;
127
+ useInternalTranscoder?: boolean | undefined;
121
128
  clipAudioStoreSamples?: boolean | undefined;
122
129
  clipAudioSampleRate?: number | undefined;
123
130
  clipAudioSampleForceMono?: boolean | undefined;
@@ -139,6 +146,8 @@ export declare const SettingsSchema: z.ZodObject<{
139
146
  renderAudioUseWorker?: boolean | undefined;
140
147
  renderCancelFailTimeout?: number | undefined;
141
148
  renderVideoUseDirectFrames?: boolean | undefined;
149
+ renderUseChunkedOutput?: boolean | undefined;
150
+ renderChunkedOutputMaxSize?: number | undefined;
142
151
  decoderUseWebCodecs?: boolean | undefined;
143
152
  decoderPreferredAcceleration?: PreferredAcceleration | undefined;
144
153
  decoderUseSeparateWorker?: boolean | undefined;
@@ -161,6 +170,7 @@ export declare const SettingsSchema: z.ZodObject<{
161
170
  }>;
162
171
  export declare class Settings {
163
172
  private m3u8MaxResolution;
173
+ private useInternalTranscoder;
164
174
  private clipAudioStoreSamples;
165
175
  private clipAudioSampleRate;
166
176
  private clipAudioSampleForceMono;
@@ -197,6 +207,8 @@ export declare class Settings {
197
207
  private renderAudioUseWorker;
198
208
  private renderCancelFailTimeout;
199
209
  private renderVideoUseDirectFrames;
210
+ private renderUseChunkedOutput;
211
+ private renderChunkedOutputMaxSize;
200
212
  private subtitlesScaleOnResize;
201
213
  private subtitlesAutoWrapOnResize;
202
214
  private viewAutoLayoutOnResize;
@@ -205,6 +217,7 @@ export declare class Settings {
205
217
  constructor();
206
218
  getDefaultSettings(): {
207
219
  m3u8MaxResolution: [number, number];
220
+ useInternalTranscoder: boolean;
208
221
  clipAudioStoreSamples: boolean;
209
222
  clipAudioSampleRate: number;
210
223
  clipAudioSampleForceMono: boolean;
@@ -226,6 +239,8 @@ export declare class Settings {
226
239
  renderAudioUseWorker: boolean;
227
240
  renderCancelFailTimeout: number;
228
241
  renderVideoUseDirectFrames: boolean;
242
+ renderUseChunkedOutput: boolean;
243
+ renderChunkedOutputMaxSize: number;
229
244
  decoderUseWebCodecs: boolean;
230
245
  decoderPreferredAcceleration: PreferredAcceleration;
231
246
  decoderUseSeparateWorker: boolean;
@@ -320,6 +335,10 @@ export declare class Settings {
320
335
  getRenderCancelFailTimeout(): number;
321
336
  setRenderVideoUseDirectFrames(use: boolean): void;
322
337
  getRenderVideoUseDirectFrames(): boolean;
338
+ setRenderUseChunkedOutput(use: boolean): void;
339
+ getRenderUseChunkedOutput(): boolean;
340
+ setRenderChunkedOutputMaxSize(size: number): void;
341
+ getRenderChunkedOutputMaxSize(): number;
323
342
  setDecoderUseWebCodecs(use: boolean): void;
324
343
  getDecoderUseWebCodecs(): boolean;
325
344
  setDecoderPreferredAcceleration(acceleration: PreferredAcceleration): void;
@@ -332,6 +351,8 @@ export declare class Settings {
332
351
  getEncoderPreferredAcceleration(): PreferredAcceleration;
333
352
  setM3u8MaxResolution(width: number, height: number): void;
334
353
  getM3u8MaxResolution(): number[];
354
+ setUseInternalTranscoder(use: boolean): void;
355
+ getUseInternalTranscoder(): boolean;
335
356
  setSubtitlesScaleOnResize(scale: boolean): void;
336
357
  getSubtitlesScaleOnResize(): boolean;
337
358
  setSubtitlesAutoWrapOnResize(autoWrap: boolean): void;
@@ -342,6 +363,7 @@ export declare class Settings {
342
363
  getMediaHashAlgorithm(): HashAlgorithmEnum;
343
364
  serialize(): {
344
365
  m3u8MaxResolution: [number, number];
366
+ useInternalTranscoder: boolean;
345
367
  clipAudioStoreSamples: boolean;
346
368
  clipAudioSampleRate: number;
347
369
  clipAudioSampleForceMono: boolean;
@@ -363,6 +385,8 @@ export declare class Settings {
363
385
  renderAudioUseWorker: boolean;
364
386
  renderCancelFailTimeout: number;
365
387
  renderVideoUseDirectFrames: boolean;
388
+ renderUseChunkedOutput: boolean;
389
+ renderChunkedOutputMaxSize: number;
366
390
  decoderUseWebCodecs: boolean;
367
391
  decoderPreferredAcceleration: PreferredAcceleration;
368
392
  decoderUseSeparateWorker: boolean;
@@ -10,7 +10,7 @@ export interface StorageStoreResults {
10
10
  }
11
11
  export interface StorageMediaData {
12
12
  hash: string;
13
- data: Uint8Array;
13
+ mediaSource: Blob | File;
14
14
  mediaId: string;
15
15
  name?: string;
16
16
  fileName?: string;
@@ -197,6 +197,7 @@ export declare class Timeline {
197
197
  getAllCustomData(): Map<string, unknown> | undefined;
198
198
  render(options?: TimelineRenderOptions): Promise<void>;
199
199
  postRender(): void;
200
+ stopRenderingLoop(): void;
200
201
  loadSerializedData(data: object): Promise<void>;
201
202
  serialize(): {
202
203
  startTime: number;
@@ -1,4 +1,5 @@
1
1
  export declare enum HashAlgorithmEnum {
2
2
  SHA256 = "SHA256",
3
- XXHash128 = "XXHash128"
3
+ XXHash128 = "XXHash128",
4
+ XXHash64 = "XXHash64"
4
5
  }
@@ -0,0 +1,18 @@
1
+ import { MediaInfo } from '../../modules/ffmpeg/types/FFmpeg.types';
2
+ interface CheckVideoCompatibilityOrTranscodeOptions {
3
+ blobUrl: string;
4
+ filePath: string;
5
+ outputPath?: string;
6
+ getData: () => Promise<Uint8Array>;
7
+ info: MediaInfo;
8
+ fileName: string;
9
+ permanentUrl?: string;
10
+ mimeType?: string;
11
+ mediaDataId: string;
12
+ waitForMediaInfoUnlock: () => Promise<void>;
13
+ lockMediaInfo: () => void;
14
+ unlockMediaInfo: () => void;
15
+ timeoutMs?: number;
16
+ }
17
+ export declare function checkVideoCompatibilityOrTranscode({ blobUrl, filePath, outputPath, getData, info, fileName, permanentUrl, mimeType, mediaDataId, waitForMediaInfoUnlock, lockMediaInfo, unlockMediaInfo, timeoutMs, }: CheckVideoCompatibilityOrTranscodeOptions): Promise<boolean>;
18
+ export {};
@@ -0,0 +1 @@
1
+ export declare function urlToBlobChunks(url: string, signal?: AbortSignal): Promise<Blob>;
@@ -0,0 +1,25 @@
1
+ import { TranscodeMediaDetails } from '../../modules/transcode';
2
+ interface InternalFFmpegTranscodeOptions {
3
+ filePath: string;
4
+ outputPath?: string;
5
+ mediaDataId: string;
6
+ waitForMediaInfoUnlock: () => Promise<void>;
7
+ lockMediaInfo: () => void;
8
+ unlockMediaInfo: () => void;
9
+ }
10
+ export declare function internalFFmpegTranscode({ filePath, outputPath, mediaDataId, waitForMediaInfoUnlock, lockMediaInfo, unlockMediaInfo, }: InternalFFmpegTranscodeOptions): Promise<boolean>;
11
+ interface TranscodeMediaOptions {
12
+ filePath: string;
13
+ outputPath?: string;
14
+ getData: () => Promise<Uint8Array>;
15
+ info: TranscodeMediaDetails["mediaInfo"];
16
+ fileName: string;
17
+ permanentUrl?: string;
18
+ mimeType?: string;
19
+ mediaDataId: string;
20
+ waitForMediaInfoUnlock: () => Promise<void>;
21
+ lockMediaInfo: () => void;
22
+ unlockMediaInfo: () => void;
23
+ }
24
+ export declare function transcodeMedia({ filePath, outputPath, getData, info, fileName, permanentUrl, mimeType, mediaDataId, waitForMediaInfoUnlock, lockMediaInfo, unlockMediaInfo, }: TranscodeMediaOptions): Promise<boolean>;
25
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rendley/sdk",
3
- "version": "1.12.26",
3
+ "version": "1.14.0",
4
4
  "license": "LICENSE",
5
5
  "author": "Onix Technologies",
6
6
  "homepage": "https://rendleysdk.com",