Interface: Spec
TurboModule spec for the native VideoTrim module, and the type of the package's default export.
Prefer the named functions (they fill in defaults and convert colors) for calling methods. Use the on* emitters on the default export to subscribe to editor events on the New Architecture; see VideoTrimEventMap for the payloads.
Extends
TurboModule
Properties
Methods
cleanFiles()
cleanFiles(): Promise<number>;Delete all output files generated by past trim operations. Returns the number of files removed.
Returns
Promise<number>
closeEditor()
closeEditor(): void;Programmatically close the editor if it is currently open.
Returns
void
compress()
compress(url, options): Promise<CompressResult>;Compress a video file to reduce its size.
Parameters
| Parameter | Type |
|---|---|
url | string |
options | CompressOptions |
Returns
Promise<CompressResult>
deleteFile()
deleteFile(filePath): Promise<boolean>;Delete a single file at the given path. Resolves true on success. On Android, paths outside the library's output directories resolve false.
Parameters
| Parameter | Type |
|---|---|
filePath | string |
Returns
Promise<boolean>
extractAudio()
extractAudio(url, options): Promise<ExtractAudioResult>;Extract the audio track from a video file into a separate audio file.
Parameters
| Parameter | Type |
|---|---|
url | string |
options | ExtractAudioOptions |
Returns
Promise<ExtractAudioResult>
getFrameAt()
getFrameAt(url, options): Promise<FrameResult>;Extract a single frame from a video at the specified timestamp.
Parameters
| Parameter | Type |
|---|---|
url | string |
options | FrameExtractionOptions |
Returns
Promise<FrameResult>
isValidFile()
isValidFile(url): Promise<FileValidationResult>;Check whether the given URL points to a valid audio or video file.
Parameters
| Parameter | Type |
|---|---|
url | string |
Returns
Promise<FileValidationResult>
listFiles()
listFiles(): Promise<string[]>;List all output files generated by past trim operations.
Returns
Promise<string[]>
merge()
merge(urls, options): Promise<MergeResult>;Merge multiple media files into a single file. Headless only, no editor UI.
Parameters
| Parameter | Type |
|---|---|
urls | readonly string[] |
options | MergeOptions |
Returns
Promise<MergeResult>
mixAudio()
mixAudio(
videoPath,
audioPath,
options
): Promise<MixAudioResult>;Mix (or replace) an external audio track into a video. Headless only, no editor UI. The video stream is copied unchanged; only audio is re-encoded.
Parameters
| Parameter | Type |
|---|---|
videoPath | string |
audioPath | string |
options | MixAudioOptions |
Returns
Promise<MixAudioResult>
saveToDocuments()
saveToDocuments(filePath): Promise<SaveToDocumentsResult>;Present the system document picker to save a file to the user's chosen location.
Parameters
| Parameter | Type |
|---|---|
filePath | string |
Returns
Promise<SaveToDocumentsResult>
saveToPhoto()
saveToPhoto(filePath): Promise<SaveToPhotoResult>;Save a file to the device's photo library. Requires photo library permission.
Parameters
| Parameter | Type |
|---|---|
filePath | string |
Returns
Promise<SaveToPhotoResult>
share()
share(filePath): Promise<ShareResult>;Open the system share sheet for a file.
Parameters
| Parameter | Type |
|---|---|
filePath | string |
Returns
Promise<ShareResult>
showEditor()
showEditor(filePath, config): void;Open the trimmer editor for the given video or audio file.
Parameters
| Parameter | Type |
|---|---|
filePath | string |
config | EditorConfig |
Returns
void
toGif()
toGif(url, options): Promise<GifResult>;Convert a video segment to an animated GIF.
Parameters
| Parameter | Type |
|---|---|
url | string |
options | GifOptions |
Returns
Promise<GifResult>
trim()
trim(url, options): Promise<TrimResult>;Perform a headless trim (no UI) on the given URL with the specified options.
Parameters
| Parameter | Type |
|---|---|
url | string |
options | TrimOptions |
Returns
Promise<TrimResult>