react-native-video-trim 7.1.1 → 8.1.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.
- package/README.md +257 -1
- package/android/src/main/java/com/videotrim/BaseVideoTrimModule.kt +488 -34
- package/android/src/main/java/com/videotrim/utils/StorageUtil.kt +95 -36
- package/android/src/main/java/com/videotrim/utils/VideoTrimmerUtil.kt +38 -16
- package/android/src/main/java/com/videotrim/widgets/VideoTrimmerView.kt +92 -5
- package/android/src/main/res/drawable/speaker_slash_fill.xml +19 -0
- package/android/src/main/res/drawable/speaker_wave_2_fill.xml +23 -0
- package/android/src/main/res/layout/video_trimmer_view.xml +25 -3
- package/android/src/newarch/VideoTrimModule.kt +33 -0
- package/android/src/oldarch/VideoTrimModule.kt +41 -0
- package/android/src/oldarch/VideoTrimSpec.kt +17 -0
- package/ios/VideoTrim.mm +160 -1
- package/ios/VideoTrim.swift +632 -39
- package/ios/VideoTrimmerViewController.swift +129 -28
- package/lib/module/NativeVideoTrim.js +52 -0
- package/lib/module/NativeVideoTrim.js.map +1 -1
- package/lib/module/index.js +143 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeVideoTrim.d.ts +161 -0
- package/lib/typescript/src/NativeVideoTrim.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +62 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeVideoTrim.ts +183 -0
- package/src/index.tsx +186 -0
|
@@ -24,6 +24,14 @@ export interface BaseOptions {
|
|
|
24
24
|
* happens regardless of this flag, so precise trimming comes for free in that case.
|
|
25
25
|
*/
|
|
26
26
|
enablePreciseTrimming: boolean;
|
|
27
|
+
/** When `true`, strips the audio track from the output. Default `false`. */
|
|
28
|
+
removeAudio: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Playback speed multiplier applied during export. `1.0` is normal speed,
|
|
31
|
+
* `2.0` is double speed, `0.5` is half speed. Valid range: 0.25–4.0.
|
|
32
|
+
* When not `1.0`, re-encoding is forced regardless of `enablePreciseTrimming`.
|
|
33
|
+
*/
|
|
34
|
+
speed: number;
|
|
27
35
|
}
|
|
28
36
|
/**
|
|
29
37
|
* Configuration for the video trimmer editor UI.
|
|
@@ -126,6 +134,19 @@ export interface EditorConfig extends BaseOptions {
|
|
|
126
134
|
* `"light"` uses a white background with black icons/text and white trimmer-handle chevrons.
|
|
127
135
|
*/
|
|
128
136
|
theme?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Format token for the editor's start / current / end time labels.
|
|
139
|
+
* Allowed values:
|
|
140
|
+
* - `"mm:ss"` — minutes:seconds (e.g. `01:23`)
|
|
141
|
+
* - `"mm:ss.SS"` — centiseconds (e.g. `01:23.45`)
|
|
142
|
+
* - `"mm:ss.SSS"` — milliseconds (e.g. `01:23.456`) — **default**
|
|
143
|
+
* - `"hh:mm:ss"` — hours:minutes:seconds (e.g. `00:01:23`)
|
|
144
|
+
* - `"hh:mm:ss.SSS"` — hours:minutes:seconds.milliseconds (e.g. `00:01:23.456`)
|
|
145
|
+
*
|
|
146
|
+
* Unknown values fall back to the default. Only affects on-screen labels;
|
|
147
|
+
* `onLoad` / `onFinishTrimming` payloads continue to report raw milliseconds.
|
|
148
|
+
*/
|
|
149
|
+
durationFormat?: string;
|
|
129
150
|
/** Color of the audio waveform bars as a `processColor` value. */
|
|
130
151
|
waveformColor?: number;
|
|
131
152
|
/** Background color behind the audio waveform bars as a `processColor` value. */
|
|
@@ -172,6 +193,130 @@ export interface TrimResult {
|
|
|
172
193
|
/** Whether the trim operation completed successfully. */
|
|
173
194
|
success: boolean;
|
|
174
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Options for extracting a single frame from a video.
|
|
198
|
+
*/
|
|
199
|
+
export interface FrameExtractionOptions {
|
|
200
|
+
/** Timestamp in milliseconds at which to extract the frame. */
|
|
201
|
+
time: number;
|
|
202
|
+
/** Output image format: `"jpeg"` (default) or `"png"`. */
|
|
203
|
+
format: string;
|
|
204
|
+
/** JPEG compression quality from 0–100. Default `80`. Ignored for PNG. */
|
|
205
|
+
quality: number;
|
|
206
|
+
/** Maximum width in pixels. Height is auto-calculated to preserve aspect ratio. `-1` for original. */
|
|
207
|
+
maxWidth: number;
|
|
208
|
+
/** Maximum height in pixels. Width is auto-calculated to preserve aspect ratio. `-1` for original. */
|
|
209
|
+
maxHeight: number;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Result returned by {@link Spec.getFrameAt}.
|
|
213
|
+
*/
|
|
214
|
+
export interface FrameResult {
|
|
215
|
+
/** Absolute path to the extracted image file. */
|
|
216
|
+
outputPath: string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Options for extracting the audio track from a video file.
|
|
220
|
+
*/
|
|
221
|
+
export interface ExtractAudioOptions {
|
|
222
|
+
/** Output audio file extension (e.g. `"mp3"`, `"m4a"`, `"wav"`). Default `"mp3"`. */
|
|
223
|
+
outputExt: string;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Result returned by {@link Spec.extractAudio}.
|
|
227
|
+
*/
|
|
228
|
+
export interface ExtractAudioResult {
|
|
229
|
+
/** Absolute path to the extracted audio file. */
|
|
230
|
+
outputPath: string;
|
|
231
|
+
/** Duration of the audio in milliseconds. */
|
|
232
|
+
duration: number;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Options for compressing a video file.
|
|
236
|
+
*/
|
|
237
|
+
export interface CompressOptions {
|
|
238
|
+
/**
|
|
239
|
+
* Quality preset: `"low"` (smallest file), `"medium"` (balanced), `"high"` (best quality).
|
|
240
|
+
* Maps to CRF 28, 23, 18 respectively. Ignored when `bitrate` is set.
|
|
241
|
+
*/
|
|
242
|
+
quality: string;
|
|
243
|
+
/** Explicit target bitrate in bits per second. Overrides `quality` when set. `-1` to use quality preset. */
|
|
244
|
+
bitrate: number;
|
|
245
|
+
/** Target width in pixels. `-1` to keep original. Height is auto-calculated to preserve aspect ratio. */
|
|
246
|
+
width: number;
|
|
247
|
+
/** Target height in pixels. `-1` to keep original. Width is auto-calculated to preserve aspect ratio. */
|
|
248
|
+
height: number;
|
|
249
|
+
/** Target frame rate. `-1` to keep original. */
|
|
250
|
+
frameRate: number;
|
|
251
|
+
/** Output file extension (e.g. `"mp4"`). Default `"mp4"`. */
|
|
252
|
+
outputExt: string;
|
|
253
|
+
/** When `true`, strips the audio track from the output. Default `false`. */
|
|
254
|
+
removeAudio: boolean;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Result returned by {@link Spec.compress}.
|
|
258
|
+
*/
|
|
259
|
+
export interface CompressResult {
|
|
260
|
+
/** Absolute path to the compressed output file. */
|
|
261
|
+
outputPath: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Options for converting a video segment to an animated GIF.
|
|
265
|
+
*/
|
|
266
|
+
export interface GifOptions {
|
|
267
|
+
/** Start time in milliseconds. Default `0`. */
|
|
268
|
+
startTime: number;
|
|
269
|
+
/** End time in milliseconds. Default `-1` (end of video). */
|
|
270
|
+
endTime: number;
|
|
271
|
+
/** Frame rate of the GIF. Default `10`. */
|
|
272
|
+
fps: number;
|
|
273
|
+
/** Width in pixels. Height is auto-calculated to preserve aspect ratio. `-1` for original. */
|
|
274
|
+
width: number;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Result returned by {@link Spec.toGif}.
|
|
278
|
+
*/
|
|
279
|
+
export interface GifResult {
|
|
280
|
+
/** Absolute path to the generated GIF file. */
|
|
281
|
+
outputPath: string;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Options for merging multiple media files into one.
|
|
285
|
+
*/
|
|
286
|
+
export interface MergeOptions {
|
|
287
|
+
/** Output file extension (e.g. `"mp4"`, `"wav"`). Default `"mp4"`. */
|
|
288
|
+
outputExt: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Result returned by {@link Spec.merge}.
|
|
292
|
+
*/
|
|
293
|
+
export interface MergeResult {
|
|
294
|
+
/** Absolute path to the merged output file. */
|
|
295
|
+
outputPath: string;
|
|
296
|
+
/** Total duration of the merged file in milliseconds. */
|
|
297
|
+
duration: number;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Result returned by {@link Spec.saveToPhoto}.
|
|
301
|
+
*/
|
|
302
|
+
export interface SaveToPhotoResult {
|
|
303
|
+
/** Whether the file was saved to the photo library successfully. */
|
|
304
|
+
success: boolean;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Result returned by {@link Spec.saveToDocuments}.
|
|
308
|
+
*/
|
|
309
|
+
export interface SaveToDocumentsResult {
|
|
310
|
+
/** Whether the file was saved to documents successfully. */
|
|
311
|
+
success: boolean;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Result returned by {@link Spec.share}.
|
|
315
|
+
*/
|
|
316
|
+
export interface ShareResult {
|
|
317
|
+
/** Whether the user completed the share action. */
|
|
318
|
+
success: boolean;
|
|
319
|
+
}
|
|
175
320
|
/**
|
|
176
321
|
* TurboModule spec for the native VideoTrim module.
|
|
177
322
|
*/
|
|
@@ -190,6 +335,22 @@ export interface Spec extends TurboModule {
|
|
|
190
335
|
isValidFile(url: string): Promise<FileValidationResult>;
|
|
191
336
|
/** Perform a headless trim (no UI) on the given URL with the specified options. */
|
|
192
337
|
trim(url: string, options: TrimOptions): Promise<TrimResult>;
|
|
338
|
+
/** Extract a single frame from a video at the specified timestamp. */
|
|
339
|
+
getFrameAt(url: string, options: FrameExtractionOptions): Promise<FrameResult>;
|
|
340
|
+
/** Extract the audio track from a video file into a separate audio file. */
|
|
341
|
+
extractAudio(url: string, options: ExtractAudioOptions): Promise<ExtractAudioResult>;
|
|
342
|
+
/** Compress a video file to reduce its size. */
|
|
343
|
+
compress(url: string, options: CompressOptions): Promise<CompressResult>;
|
|
344
|
+
/** Convert a video segment to an animated GIF. */
|
|
345
|
+
toGif(url: string, options: GifOptions): Promise<GifResult>;
|
|
346
|
+
/** Merge multiple media files into a single file. Headless only, no editor UI. */
|
|
347
|
+
merge(urls: ReadonlyArray<string>, options: MergeOptions): Promise<MergeResult>;
|
|
348
|
+
/** Save a file to the device's photo library. Requires photo library permission. */
|
|
349
|
+
saveToPhoto(filePath: string): Promise<SaveToPhotoResult>;
|
|
350
|
+
/** Present the system document picker to save a file to the user's chosen location. */
|
|
351
|
+
saveToDocuments(filePath: string): Promise<SaveToDocumentsResult>;
|
|
352
|
+
/** Open the system share sheet for a file. */
|
|
353
|
+
share(filePath: string): Promise<ShareResult>;
|
|
193
354
|
/** Emitted when the trim operation starts. */
|
|
194
355
|
readonly onStartTrimming: EventEmitter<void>;
|
|
195
356
|
/** Emitted when the user cancels an in-progress trim operation. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeVideoTrim.d.ts","sourceRoot":"","sources":["../../../src/NativeVideoTrim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,WAAW,EAAE,OAAO,CAAC;IACrB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,uBAAuB,EAAE,OAAO,CAAC;IACjC,8EAA8E;IAC9E,4BAA4B,EAAE,OAAO,CAAC;IACtC;;;;;;;;OAQG;IACH,qBAAqB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeVideoTrim.d.ts","sourceRoot":"","sources":["../../../src/NativeVideoTrim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAE9E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,oDAAoD;QACpD,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;QAClC,SAAS,EAAE,MAAM,CAAC;QAClB,gBAAgB,EAAE,MAAM,CAAC;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;QAC7B,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;QAC5B,oDAAoD;QACpD,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ;;AAED,wBAAmE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditorConfig, FileValidationResult, TrimOptions, TrimResult } from './NativeVideoTrim';
|
|
1
|
+
import type { CompressOptions, CompressResult, EditorConfig, ExtractAudioOptions, ExtractAudioResult, FileValidationResult, FrameExtractionOptions, FrameResult, GifOptions, GifResult, MergeOptions, MergeResult, SaveToDocumentsResult, SaveToPhotoResult, ShareResult, TrimOptions, TrimResult } from './NativeVideoTrim';
|
|
2
2
|
declare const VideoTrim: any;
|
|
3
3
|
/**
|
|
4
4
|
* Show video editor
|
|
@@ -53,6 +53,67 @@ export declare function isValidFile(url: string): Promise<FileValidationResult>;
|
|
|
53
53
|
* @returns {Promise<TrimResult>} A **Promise** which resolves to the TrimResult interface
|
|
54
54
|
*/
|
|
55
55
|
export declare function trim(url: string, options: Partial<TrimOptions>): Promise<TrimResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Extract a single frame from a video at a given timestamp
|
|
58
|
+
*
|
|
59
|
+
* @param {string} url: absolute non-empty file path
|
|
60
|
+
* @param {Partial<FrameExtractionOptions>} options: extraction options
|
|
61
|
+
* @returns {Promise<FrameResult>} A **Promise** which resolves to the FrameResult
|
|
62
|
+
*/
|
|
63
|
+
export declare function getFrameAt(url: string, options?: Partial<FrameExtractionOptions>): Promise<FrameResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Extract the audio track from a video file
|
|
66
|
+
*
|
|
67
|
+
* @param {string} url: absolute non-empty file path
|
|
68
|
+
* @param {Partial<ExtractAudioOptions>} options: extraction options
|
|
69
|
+
* @returns {Promise<ExtractAudioResult>} A **Promise** which resolves to the result
|
|
70
|
+
*/
|
|
71
|
+
export declare function extractAudio(url: string, options?: Partial<ExtractAudioOptions>): Promise<ExtractAudioResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Compress a video file to reduce its size
|
|
74
|
+
*
|
|
75
|
+
* @param {string} url: absolute non-empty file path
|
|
76
|
+
* @param {Partial<CompressOptions>} options: compression options
|
|
77
|
+
* @returns {Promise<CompressResult>} A **Promise** which resolves to the result
|
|
78
|
+
*/
|
|
79
|
+
export declare function compress(url: string, options?: Partial<CompressOptions>): Promise<CompressResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Convert a video segment to an animated GIF
|
|
82
|
+
*
|
|
83
|
+
* @param {string} url: absolute non-empty file path
|
|
84
|
+
* @param {Partial<GifOptions>} options: GIF conversion options
|
|
85
|
+
* @returns {Promise<GifResult>} A **Promise** which resolves to the result
|
|
86
|
+
*/
|
|
87
|
+
export declare function toGif(url: string, options?: Partial<GifOptions>): Promise<GifResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Merge multiple media files into a single file (headless, no UI)
|
|
90
|
+
*
|
|
91
|
+
* @param {string[]} urls: array of file paths to merge in order
|
|
92
|
+
* @param {Partial<MergeOptions>} options: merge options
|
|
93
|
+
* @returns {Promise<MergeResult>} A **Promise** which resolves to the result
|
|
94
|
+
*/
|
|
95
|
+
export declare function merge(urls: string[], options?: Partial<MergeOptions>): Promise<MergeResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Save a file to the device's photo library
|
|
98
|
+
*
|
|
99
|
+
* @param {string} filePath: absolute path to the file
|
|
100
|
+
* @returns {Promise<SaveToPhotoResult>} A **Promise** which resolves to the result
|
|
101
|
+
*/
|
|
102
|
+
export declare function saveToPhoto(filePath: string): Promise<SaveToPhotoResult>;
|
|
103
|
+
/**
|
|
104
|
+
* Present the system document picker to save a file
|
|
105
|
+
*
|
|
106
|
+
* @param {string} filePath: absolute path to the file
|
|
107
|
+
* @returns {Promise<SaveToDocumentsResult>} A **Promise** which resolves to the result
|
|
108
|
+
*/
|
|
109
|
+
export declare function saveToDocuments(filePath: string): Promise<SaveToDocumentsResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Open the system share sheet for a file
|
|
112
|
+
*
|
|
113
|
+
* @param {string} filePath: absolute path to the file
|
|
114
|
+
* @returns {Promise<ShareResult>} A **Promise** which resolves to the result
|
|
115
|
+
*/
|
|
116
|
+
export declare function share(filePath: string): Promise<ShareResult>;
|
|
56
117
|
export * from './NativeVideoTrim';
|
|
57
118
|
export default VideoTrim;
|
|
58
119
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,UAAU,EACX,MAAM,mBAAmB,CAAC;AAK3B,QAAA,MAAM,SAAS,KAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx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CAErB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC5C,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GACzC,OAAO,CAAC,kBAAkB,CAAC,CAE7B;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,OAAO,CAAC,eAAe,CAAM,GACrC,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,OAAO,CAAC,UAAU,CAAM,GAChC,OAAO,CAAC,SAAS,CAAC,CAEpB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,OAAO,CAAC,YAAY,CAAM,GAClC,OAAO,CAAC,WAAW,CAAC,CAKtB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAKxE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,qBAAqB,CAAC,CAKhC;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAK5D;AAED,cAAc,mBAAmB,CAAC;AAClC,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
package/src/NativeVideoTrim.ts
CHANGED
|
@@ -26,6 +26,14 @@ export interface BaseOptions {
|
|
|
26
26
|
* happens regardless of this flag, so precise trimming comes for free in that case.
|
|
27
27
|
*/
|
|
28
28
|
enablePreciseTrimming: boolean;
|
|
29
|
+
/** When `true`, strips the audio track from the output. Default `false`. */
|
|
30
|
+
removeAudio: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Playback speed multiplier applied during export. `1.0` is normal speed,
|
|
33
|
+
* `2.0` is double speed, `0.5` is half speed. Valid range: 0.25–4.0.
|
|
34
|
+
* When not `1.0`, re-encoding is forced regardless of `enablePreciseTrimming`.
|
|
35
|
+
*/
|
|
36
|
+
speed: number;
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
/**
|
|
@@ -129,6 +137,19 @@ export interface EditorConfig extends BaseOptions {
|
|
|
129
137
|
* `"light"` uses a white background with black icons/text and white trimmer-handle chevrons.
|
|
130
138
|
*/
|
|
131
139
|
theme?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Format token for the editor's start / current / end time labels.
|
|
142
|
+
* Allowed values:
|
|
143
|
+
* - `"mm:ss"` — minutes:seconds (e.g. `01:23`)
|
|
144
|
+
* - `"mm:ss.SS"` — centiseconds (e.g. `01:23.45`)
|
|
145
|
+
* - `"mm:ss.SSS"` — milliseconds (e.g. `01:23.456`) — **default**
|
|
146
|
+
* - `"hh:mm:ss"` — hours:minutes:seconds (e.g. `00:01:23`)
|
|
147
|
+
* - `"hh:mm:ss.SSS"` — hours:minutes:seconds.milliseconds (e.g. `00:01:23.456`)
|
|
148
|
+
*
|
|
149
|
+
* Unknown values fall back to the default. Only affects on-screen labels;
|
|
150
|
+
* `onLoad` / `onFinishTrimming` payloads continue to report raw milliseconds.
|
|
151
|
+
*/
|
|
152
|
+
durationFormat?: string;
|
|
132
153
|
/** Color of the audio waveform bars as a `processColor` value. */
|
|
133
154
|
waveformColor?: number;
|
|
134
155
|
/** Background color behind the audio waveform bars as a `processColor` value. */
|
|
@@ -179,6 +200,143 @@ export interface TrimResult {
|
|
|
179
200
|
success: boolean;
|
|
180
201
|
}
|
|
181
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Options for extracting a single frame from a video.
|
|
205
|
+
*/
|
|
206
|
+
export interface FrameExtractionOptions {
|
|
207
|
+
/** Timestamp in milliseconds at which to extract the frame. */
|
|
208
|
+
time: number;
|
|
209
|
+
/** Output image format: `"jpeg"` (default) or `"png"`. */
|
|
210
|
+
format: string;
|
|
211
|
+
/** JPEG compression quality from 0–100. Default `80`. Ignored for PNG. */
|
|
212
|
+
quality: number;
|
|
213
|
+
/** Maximum width in pixels. Height is auto-calculated to preserve aspect ratio. `-1` for original. */
|
|
214
|
+
maxWidth: number;
|
|
215
|
+
/** Maximum height in pixels. Width is auto-calculated to preserve aspect ratio. `-1` for original. */
|
|
216
|
+
maxHeight: number;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Result returned by {@link Spec.getFrameAt}.
|
|
221
|
+
*/
|
|
222
|
+
export interface FrameResult {
|
|
223
|
+
/** Absolute path to the extracted image file. */
|
|
224
|
+
outputPath: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Options for extracting the audio track from a video file.
|
|
229
|
+
*/
|
|
230
|
+
export interface ExtractAudioOptions {
|
|
231
|
+
/** Output audio file extension (e.g. `"mp3"`, `"m4a"`, `"wav"`). Default `"mp3"`. */
|
|
232
|
+
outputExt: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Result returned by {@link Spec.extractAudio}.
|
|
237
|
+
*/
|
|
238
|
+
export interface ExtractAudioResult {
|
|
239
|
+
/** Absolute path to the extracted audio file. */
|
|
240
|
+
outputPath: string;
|
|
241
|
+
/** Duration of the audio in milliseconds. */
|
|
242
|
+
duration: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Options for compressing a video file.
|
|
247
|
+
*/
|
|
248
|
+
export interface CompressOptions {
|
|
249
|
+
/**
|
|
250
|
+
* Quality preset: `"low"` (smallest file), `"medium"` (balanced), `"high"` (best quality).
|
|
251
|
+
* Maps to CRF 28, 23, 18 respectively. Ignored when `bitrate` is set.
|
|
252
|
+
*/
|
|
253
|
+
quality: string;
|
|
254
|
+
/** Explicit target bitrate in bits per second. Overrides `quality` when set. `-1` to use quality preset. */
|
|
255
|
+
bitrate: number;
|
|
256
|
+
/** Target width in pixels. `-1` to keep original. Height is auto-calculated to preserve aspect ratio. */
|
|
257
|
+
width: number;
|
|
258
|
+
/** Target height in pixels. `-1` to keep original. Width is auto-calculated to preserve aspect ratio. */
|
|
259
|
+
height: number;
|
|
260
|
+
/** Target frame rate. `-1` to keep original. */
|
|
261
|
+
frameRate: number;
|
|
262
|
+
/** Output file extension (e.g. `"mp4"`). Default `"mp4"`. */
|
|
263
|
+
outputExt: string;
|
|
264
|
+
/** When `true`, strips the audio track from the output. Default `false`. */
|
|
265
|
+
removeAudio: boolean;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Result returned by {@link Spec.compress}.
|
|
270
|
+
*/
|
|
271
|
+
export interface CompressResult {
|
|
272
|
+
/** Absolute path to the compressed output file. */
|
|
273
|
+
outputPath: string;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Options for converting a video segment to an animated GIF.
|
|
278
|
+
*/
|
|
279
|
+
export interface GifOptions {
|
|
280
|
+
/** Start time in milliseconds. Default `0`. */
|
|
281
|
+
startTime: number;
|
|
282
|
+
/** End time in milliseconds. Default `-1` (end of video). */
|
|
283
|
+
endTime: number;
|
|
284
|
+
/** Frame rate of the GIF. Default `10`. */
|
|
285
|
+
fps: number;
|
|
286
|
+
/** Width in pixels. Height is auto-calculated to preserve aspect ratio. `-1` for original. */
|
|
287
|
+
width: number;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Result returned by {@link Spec.toGif}.
|
|
292
|
+
*/
|
|
293
|
+
export interface GifResult {
|
|
294
|
+
/** Absolute path to the generated GIF file. */
|
|
295
|
+
outputPath: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Options for merging multiple media files into one.
|
|
300
|
+
*/
|
|
301
|
+
export interface MergeOptions {
|
|
302
|
+
/** Output file extension (e.g. `"mp4"`, `"wav"`). Default `"mp4"`. */
|
|
303
|
+
outputExt: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Result returned by {@link Spec.merge}.
|
|
308
|
+
*/
|
|
309
|
+
export interface MergeResult {
|
|
310
|
+
/** Absolute path to the merged output file. */
|
|
311
|
+
outputPath: string;
|
|
312
|
+
/** Total duration of the merged file in milliseconds. */
|
|
313
|
+
duration: number;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Result returned by {@link Spec.saveToPhoto}.
|
|
318
|
+
*/
|
|
319
|
+
export interface SaveToPhotoResult {
|
|
320
|
+
/** Whether the file was saved to the photo library successfully. */
|
|
321
|
+
success: boolean;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Result returned by {@link Spec.saveToDocuments}.
|
|
326
|
+
*/
|
|
327
|
+
export interface SaveToDocumentsResult {
|
|
328
|
+
/** Whether the file was saved to documents successfully. */
|
|
329
|
+
success: boolean;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Result returned by {@link Spec.share}.
|
|
334
|
+
*/
|
|
335
|
+
export interface ShareResult {
|
|
336
|
+
/** Whether the user completed the share action. */
|
|
337
|
+
success: boolean;
|
|
338
|
+
}
|
|
339
|
+
|
|
182
340
|
/**
|
|
183
341
|
* TurboModule spec for the native VideoTrim module.
|
|
184
342
|
*/
|
|
@@ -197,6 +355,31 @@ export interface Spec extends TurboModule {
|
|
|
197
355
|
isValidFile(url: string): Promise<FileValidationResult>;
|
|
198
356
|
/** Perform a headless trim (no UI) on the given URL with the specified options. */
|
|
199
357
|
trim(url: string, options: TrimOptions): Promise<TrimResult>;
|
|
358
|
+
/** Extract a single frame from a video at the specified timestamp. */
|
|
359
|
+
getFrameAt(
|
|
360
|
+
url: string,
|
|
361
|
+
options: FrameExtractionOptions
|
|
362
|
+
): Promise<FrameResult>;
|
|
363
|
+
/** Extract the audio track from a video file into a separate audio file. */
|
|
364
|
+
extractAudio(
|
|
365
|
+
url: string,
|
|
366
|
+
options: ExtractAudioOptions
|
|
367
|
+
): Promise<ExtractAudioResult>;
|
|
368
|
+
/** Compress a video file to reduce its size. */
|
|
369
|
+
compress(url: string, options: CompressOptions): Promise<CompressResult>;
|
|
370
|
+
/** Convert a video segment to an animated GIF. */
|
|
371
|
+
toGif(url: string, options: GifOptions): Promise<GifResult>;
|
|
372
|
+
/** Merge multiple media files into a single file. Headless only, no editor UI. */
|
|
373
|
+
merge(
|
|
374
|
+
urls: ReadonlyArray<string>,
|
|
375
|
+
options: MergeOptions
|
|
376
|
+
): Promise<MergeResult>;
|
|
377
|
+
/** Save a file to the device's photo library. Requires photo library permission. */
|
|
378
|
+
saveToPhoto(filePath: string): Promise<SaveToPhotoResult>;
|
|
379
|
+
/** Present the system document picker to save a file to the user's chosen location. */
|
|
380
|
+
saveToDocuments(filePath: string): Promise<SaveToDocumentsResult>;
|
|
381
|
+
/** Open the system share sheet for a file. */
|
|
382
|
+
share(filePath: string): Promise<ShareResult>;
|
|
200
383
|
|
|
201
384
|
/** Emitted when the trim operation starts. */
|
|
202
385
|
readonly onStartTrimming: EventEmitter<void>;
|