react-native-video-trim 3.0.10 → 4.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/LICENSE +1 -1
- package/README.md +80 -63
- package/VideoTrim.podspec +24 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +82 -49
- package/android/gradle.properties +7 -5
- package/android/src/main/AndroidManifest.xml +4 -2
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/videotrim/VideoTrim.kt +646 -0
- package/android/src/main/java/com/margelo/nitro/videotrim/VideoTrimPackage.kt +22 -0
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/enums/ErrorCode.java +1 -1
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/interfaces/IVideoTrimmerView.java +1 -1
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/interfaces/VideoTrimListener.java +6 -5
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/utils/MediaMetadataUtil.java +1 -1
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/utils/StorageUtil.java +3 -1
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/utils/VideoTrimmerUtil.java +51 -41
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/widgets/VideoTrimmerView.java +45 -69
- package/ios/AssetLoader.swift +2 -2
- package/ios/ErrorCode.swift +2 -2
- package/ios/ProgressAlertController.swift +2 -2
- package/ios/VideoTrim.swift +52 -835
- package/ios/VideoTrimImpl.swift +957 -0
- package/ios/VideoTrimmer.swift +2 -3
- package/ios/VideoTrimmerThumb.swift +33 -26
- package/ios/VideoTrimmerViewController.swift +47 -28
- package/lib/module/VideoTrim.nitro.js +4 -0
- package/lib/module/VideoTrim.nitro.js.map +1 -0
- package/lib/module/index.js +98 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/{index.d.ts → src/VideoTrim.nitro.d.ts} +125 -134
- package/lib/typescript/src/VideoTrim.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +49 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JEditorConfig.hpp +237 -0
- package/nitrogen/generated/android/c++/JFileValidationResult.hpp +61 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__unordered_map_std__string__std__string_.hpp +89 -0
- package/nitrogen/generated/android/c++/JHybridVideoTrimSpec.cpp +151 -0
- package/nitrogen/generated/android/c++/JHybridVideoTrimSpec.hpp +68 -0
- package/nitrogen/generated/android/c++/JTrimOptions.hpp +109 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/EditorConfig.kt +72 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/FileValidationResult.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/Func_void_std__string_std__unordered_map_std__string__std__string_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/HybridVideoTrimSpec.kt +86 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/TrimOptions.kt +40 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/videotrimOnLoad.kt +35 -0
- package/nitrogen/generated/android/videotrim+autolinking.cmake +78 -0
- package/nitrogen/generated/android/videotrim+autolinking.gradle +27 -0
- package/nitrogen/generated/android/videotrimOnLoad.cpp +50 -0
- package/nitrogen/generated/android/videotrimOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/VideoTrim+autolinking.rb +60 -0
- package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Bridge.cpp +96 -0
- package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Bridge.hpp +374 -0
- package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Umbrella.hpp +56 -0
- package/nitrogen/generated/ios/VideoTrimAutolinking.mm +33 -0
- package/nitrogen/generated/ios/VideoTrimAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridVideoTrimSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoTrimSpecSwift.hpp +127 -0
- package/nitrogen/generated/ios/swift/EditorConfig.swift +541 -0
- package/nitrogen/generated/ios/swift/FileValidationResult.swift +57 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_FileValidationResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_std__unordered_map_std__string__std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridVideoTrimSpec.swift +54 -0
- package/nitrogen/generated/ios/swift/HybridVideoTrimSpec_cxx.swift +241 -0
- package/nitrogen/generated/ios/swift/TrimOptions.swift +189 -0
- package/nitrogen/generated/shared/c++/EditorConfig.hpp +253 -0
- package/nitrogen/generated/shared/c++/FileValidationResult.hpp +77 -0
- package/nitrogen/generated/shared/c++/HybridVideoTrimSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridVideoTrimSpec.hpp +80 -0
- package/nitrogen/generated/shared/c++/TrimOptions.hpp +125 -0
- package/package.json +75 -71
- package/src/VideoTrim.nitro.ts +263 -0
- package/src/index.tsx +120 -257
- package/android/src/main/AndroidManifestDeprecated.xml +0 -3
- package/android/src/main/java/com/videotrim/VideoTrimModule.java +0 -603
- package/android/src/main/java/com/videotrim/VideoTrimPackage.java +0 -28
- package/ios/VideoTrim-Bridging-Header.h +0 -2
- package/ios/VideoTrim.mm +0 -17
- package/ios/VideoTrim.xcodeproj/project.pbxproj +0 -283
- package/lib/commonjs/index.js +0 -87
- package/lib/commonjs/index.js.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/react-native-video-trim.podspec +0 -43
package/src/index.tsx
CHANGED
|
@@ -1,255 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
2
|
+
import type {
|
|
3
|
+
BaseOptions,
|
|
4
|
+
EditorConfig,
|
|
5
|
+
FileValidationResult,
|
|
6
|
+
TrimOptions,
|
|
7
|
+
VideoTrim,
|
|
8
|
+
} from './VideoTrim.nitro';
|
|
9
|
+
import { processColor } from 'react-native';
|
|
7
10
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
11
|
-
'- You rebuilt the app after installing the package\n' +
|
|
12
|
-
'- You are not using Expo Go\n';
|
|
11
|
+
const VideoTrimHybridObject =
|
|
12
|
+
NitroModules.createHybridObject<VideoTrim>('VideoTrim');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
function createBaseOptions(overrides: Partial<BaseOptions> = {}): BaseOptions {
|
|
15
|
+
return {
|
|
16
|
+
saveToPhoto: false,
|
|
17
|
+
type: 'video',
|
|
18
|
+
outputExt: 'mp4',
|
|
19
|
+
openDocumentsOnFinish: false,
|
|
20
|
+
openShareSheetOnFinish: false,
|
|
21
|
+
removeAfterSavedToPhoto: false,
|
|
22
|
+
removeAfterFailedToSavePhoto: false,
|
|
23
|
+
removeAfterSavedToDocuments: false,
|
|
24
|
+
removeAfterFailedToSaveDocuments: false,
|
|
25
|
+
removeAfterShared: false,
|
|
26
|
+
removeAfterFailedToShare: false,
|
|
27
|
+
enableRotation: false,
|
|
28
|
+
rotationAngle: 0,
|
|
29
|
+
...overrides,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function createEditorConfig(
|
|
34
|
+
overrides: Partial<EditorConfig> = {}
|
|
35
|
+
): EditorConfig {
|
|
36
|
+
return {
|
|
37
|
+
enableHapticFeedback: true,
|
|
38
|
+
maxDuration: -1, // Adjust default as needed
|
|
39
|
+
minDuration: 1000,
|
|
40
|
+
cancelButtonText: 'Cancel',
|
|
41
|
+
saveButtonText: 'Save',
|
|
42
|
+
enableCancelDialog: true,
|
|
43
|
+
cancelDialogTitle: 'Warning!',
|
|
44
|
+
cancelDialogMessage: 'Are you sure want to cancel?',
|
|
45
|
+
cancelDialogCancelText: 'Close',
|
|
46
|
+
cancelDialogConfirmText: 'Proceed',
|
|
47
|
+
enableSaveDialog: true,
|
|
48
|
+
saveDialogTitle: 'Confirmation!',
|
|
49
|
+
saveDialogMessage: 'Are you sure want to save?',
|
|
50
|
+
saveDialogCancelText: 'Close',
|
|
51
|
+
saveDialogConfirmText: 'Proceed',
|
|
52
|
+
trimmingText: 'Trimming video...',
|
|
53
|
+
fullScreenModalIOS: false,
|
|
54
|
+
autoplay: false, // Adjust default as needed
|
|
55
|
+
jumpToPositionOnLoad: -1,
|
|
56
|
+
closeWhenFinish: true,
|
|
57
|
+
enableCancelTrimming: true,
|
|
58
|
+
cancelTrimmingButtonText: 'Cancel',
|
|
59
|
+
enableCancelTrimmingDialog: true,
|
|
60
|
+
cancelTrimmingDialogTitle: 'Warning!',
|
|
61
|
+
cancelTrimmingDialogMessage: 'Are you sure want to cancel trimming?',
|
|
62
|
+
cancelTrimmingDialogCancelText: 'Close',
|
|
63
|
+
cancelTrimmingDialogConfirmText: 'Proceed',
|
|
64
|
+
headerText: '', // Adjust default as needed
|
|
65
|
+
headerTextSize: 16,
|
|
66
|
+
headerTextColor: processColor('white') as number,
|
|
67
|
+
alertOnFailToLoad: true,
|
|
68
|
+
alertOnFailTitle: 'Error',
|
|
69
|
+
alertOnFailMessage:
|
|
70
|
+
'Fail to load media. Possibly invalid file or no network connection',
|
|
71
|
+
alertOnFailCloseText: 'Close',
|
|
72
|
+
...createBaseOptions(overrides),
|
|
73
|
+
...overrides,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
24
76
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* Save the output file to Photos Library. Only video is supported. Note that you have to make sure you have permission to save to Photos Library.
|
|
33
|
-
* @default false
|
|
34
|
-
*/
|
|
35
|
-
saveToPhoto?: boolean;
|
|
36
|
-
maxDuration?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Minimum duration for trimmer
|
|
39
|
-
* @default 1000
|
|
40
|
-
*/
|
|
41
|
-
minDuration?: number;
|
|
42
|
-
/**
|
|
43
|
-
* Cancel button text
|
|
44
|
-
* @default "Cancel"
|
|
45
|
-
*/
|
|
46
|
-
cancelButtonText?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Save button text
|
|
49
|
-
* @default "Save"
|
|
50
|
-
*/
|
|
51
|
-
saveButtonText?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Enable cancel dialog
|
|
54
|
-
* @default true
|
|
55
|
-
*/
|
|
56
|
-
enableCancelDialog?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Cancel dialog title
|
|
59
|
-
* @default "Warning!"
|
|
60
|
-
*/
|
|
61
|
-
cancelDialogTitle?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Cancel dialog message
|
|
64
|
-
* @default "Are you sure want to cancel?"
|
|
65
|
-
*/
|
|
66
|
-
cancelDialogMessage?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Cancel dialog cancel text
|
|
69
|
-
* @default "Close"
|
|
70
|
-
*/
|
|
71
|
-
cancelDialogCancelText?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Cancel dialog confirm text
|
|
74
|
-
* @default "Proceed"
|
|
75
|
-
*/
|
|
76
|
-
cancelDialogConfirmText?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Enable save dialog
|
|
79
|
-
* @default true
|
|
80
|
-
*/
|
|
81
|
-
enableSaveDialog?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Save dialog title
|
|
84
|
-
* @default "Confirmation!"
|
|
85
|
-
*/
|
|
86
|
-
saveDialogTitle?: string;
|
|
87
|
-
/**
|
|
88
|
-
* Save dialog message
|
|
89
|
-
* @default "Are you sure want to save?"
|
|
90
|
-
*/
|
|
91
|
-
saveDialogMessage?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Save dialog cancel text
|
|
94
|
-
* @default "Close"
|
|
95
|
-
*/
|
|
96
|
-
saveDialogCancelText?: string;
|
|
97
|
-
/**
|
|
98
|
-
* Save dialog confirm text
|
|
99
|
-
* @default "Proceed"
|
|
100
|
-
*/
|
|
101
|
-
saveDialogConfirmText?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Trimming text
|
|
104
|
-
* @default "Trimming video..."
|
|
105
|
-
*/
|
|
106
|
-
trimmingText?: string;
|
|
107
|
-
/**
|
|
108
|
-
* By default, on iOS the editor will be presented as a modal. If you want to present it as a full screen modal, set this to `true`.
|
|
109
|
-
* @default false
|
|
110
|
-
*/
|
|
111
|
-
fullScreenModalIOS?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Type of the file to edit. If video file, recommend to use `video`. If audio file, recommend to use `audio`.
|
|
114
|
-
* @default "video"
|
|
115
|
-
*/
|
|
116
|
-
type?: 'video' | 'audio';
|
|
117
|
-
/**
|
|
118
|
-
* Output file extension. If video file, recommend to use `mp4` or `mov`. If audio file, recommend to use `wav` or `m4a`.
|
|
119
|
-
* @default "mp4"
|
|
120
|
-
* @example "mp4", "mov", "wav", "m4a", "3gp", "avi", "mkv", "flv", "wmv", "webm"
|
|
121
|
-
*/
|
|
122
|
-
outputExt?: string;
|
|
123
|
-
/**
|
|
124
|
-
* Whether to open Documents app after finish editing
|
|
125
|
-
* @default false
|
|
126
|
-
*/
|
|
127
|
-
openDocumentsOnFinish?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Whether to open Share Sheet after finish editing
|
|
130
|
-
* @default false
|
|
131
|
-
*/
|
|
132
|
-
openShareSheetOnFinish?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Remove the file after saved to Photos Library
|
|
135
|
-
* @default false
|
|
136
|
-
*/
|
|
137
|
-
removeAfterSavedToPhoto?: boolean;
|
|
138
|
-
/**
|
|
139
|
-
* Remove the file after failed to save to Photos Library
|
|
140
|
-
* @default false
|
|
141
|
-
*/
|
|
142
|
-
removeAfterFailedToSavePhoto?: boolean;
|
|
143
|
-
/**
|
|
144
|
-
* Remove the file after saved to Documents app
|
|
145
|
-
* @default false
|
|
146
|
-
*/
|
|
147
|
-
removeAfterSavedToDocuments?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Remove the file after failed to save to Documents app
|
|
150
|
-
* @default false
|
|
151
|
-
*/
|
|
152
|
-
removeAfterFailedToSaveDocuments?: boolean;
|
|
153
|
-
/**
|
|
154
|
-
* Remove the file after shared to other apps. Currently only support iOS, on Android there's no way to detect if the file is shared or not.
|
|
155
|
-
* @default false
|
|
156
|
-
*/
|
|
157
|
-
removeAfterShared?: boolean;
|
|
158
|
-
/**
|
|
159
|
-
* Remove the file after failed to share to other apps. Currently only support iOS, on Android there's no way to detect if the file is shared or not.
|
|
160
|
-
* @default false
|
|
161
|
-
*/
|
|
162
|
-
removeAfterFailedToShare?: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Whether to enable autoplay on load
|
|
165
|
-
*/
|
|
166
|
-
autoplay?: boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Jump to position on load in milliseconds
|
|
169
|
-
* @default `undefined` (beginning of the video)
|
|
170
|
-
*/
|
|
171
|
-
jumpToPositionOnLoad?: number;
|
|
172
|
-
/**
|
|
173
|
-
* Whether to close the editor when finish editing
|
|
174
|
-
* @default true
|
|
175
|
-
*/
|
|
176
|
-
closeWhenFinish?: boolean;
|
|
177
|
-
/**
|
|
178
|
-
* Enable cancel trimming
|
|
179
|
-
* @default true
|
|
180
|
-
*/
|
|
181
|
-
enableCancelTrimming?: boolean;
|
|
182
|
-
/**
|
|
183
|
-
* Cancel trimming button text
|
|
184
|
-
* @default "Cancel"
|
|
185
|
-
*/
|
|
186
|
-
cancelTrimmingButtonText?: string;
|
|
187
|
-
/**
|
|
188
|
-
* Enable cancel trimming dialog
|
|
189
|
-
* @default true
|
|
190
|
-
*/
|
|
191
|
-
enableCancelTrimmingDialog?: boolean;
|
|
192
|
-
/**
|
|
193
|
-
* Cancel trimming dialog title
|
|
194
|
-
* @default "Warning!"
|
|
195
|
-
*/
|
|
196
|
-
cancelTrimmingDialogTitle?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Cancel trimming dialog message
|
|
199
|
-
* @default "Are you sure want to cancel trimming?"
|
|
200
|
-
*/
|
|
201
|
-
cancelTrimmingDialogMessage?: string;
|
|
202
|
-
/**
|
|
203
|
-
* Cancel trimming dialog cancel text
|
|
204
|
-
* @default "Close"
|
|
205
|
-
*/
|
|
206
|
-
cancelTrimmingDialogCancelText?: string;
|
|
207
|
-
/**
|
|
208
|
-
* Cancel trimming dialog confirm text
|
|
209
|
-
* @default "Proceed"
|
|
210
|
-
*/
|
|
211
|
-
cancelTrimmingDialogConfirmText?: string;
|
|
212
|
-
/**
|
|
213
|
-
* Header text
|
|
214
|
-
*/
|
|
215
|
-
headerText?: string;
|
|
216
|
-
/**
|
|
217
|
-
* Header text size
|
|
218
|
-
* @default 16
|
|
219
|
-
*/
|
|
220
|
-
headerTextSize?: number;
|
|
221
|
-
/**
|
|
222
|
-
* Header text color
|
|
223
|
-
* @default white
|
|
224
|
-
*/
|
|
225
|
-
headerTextColor?: ColorValue;
|
|
226
|
-
/**
|
|
227
|
-
* Alert on fail to load media
|
|
228
|
-
* @default true
|
|
229
|
-
*/
|
|
230
|
-
alertOnFailToLoad?: boolean;
|
|
231
|
-
/**
|
|
232
|
-
* Alert on fail to load media title
|
|
233
|
-
* @default "Error"
|
|
234
|
-
*/
|
|
235
|
-
alertOnFailTitle?: string;
|
|
236
|
-
/**
|
|
237
|
-
* Alert on fail to load media message
|
|
238
|
-
* @default "Fail to load media. Possibly invalid file or no network connection"
|
|
239
|
-
*/
|
|
240
|
-
alertOnFailMessage?: string;
|
|
241
|
-
/**
|
|
242
|
-
* Alert on fail to load media close text
|
|
243
|
-
* @default "Close"
|
|
244
|
-
*/
|
|
245
|
-
alertOnFailCloseText?: string;
|
|
246
|
-
/**
|
|
247
|
-
* Progress update interval in seconds
|
|
248
|
-
* @default 0.1
|
|
249
|
-
*/
|
|
250
|
-
progressUpdateInterval?: number;
|
|
77
|
+
function createTrimOptions(overrides: Partial<TrimOptions> = {}): TrimOptions {
|
|
78
|
+
return {
|
|
79
|
+
startTime: 0,
|
|
80
|
+
endTime: 1000,
|
|
81
|
+
...createBaseOptions(overrides),
|
|
82
|
+
...overrides,
|
|
83
|
+
};
|
|
251
84
|
}
|
|
252
85
|
|
|
86
|
+
function noop() {}
|
|
87
|
+
|
|
253
88
|
/**
|
|
254
89
|
* Delete a file
|
|
255
90
|
*
|
|
@@ -257,10 +92,24 @@ export interface EditorConfig {
|
|
|
257
92
|
* @param {EditorConfig} config: editor configuration
|
|
258
93
|
* @returns {void} A **Promise** which resolves `void`
|
|
259
94
|
*/
|
|
260
|
-
export function showEditor(
|
|
95
|
+
export function showEditor(
|
|
96
|
+
filePath: string,
|
|
97
|
+
config: Partial<Omit<EditorConfig, 'headerTextColor'>> & {
|
|
98
|
+
headerTextColor?: string;
|
|
99
|
+
},
|
|
100
|
+
onEvent?: (eventName: string, payload: Record<string, string>) => void
|
|
101
|
+
): void {
|
|
261
102
|
const { headerTextColor } = config;
|
|
262
|
-
const color = processColor(headerTextColor);
|
|
263
|
-
|
|
103
|
+
const color = processColor(headerTextColor || 'white');
|
|
104
|
+
|
|
105
|
+
VideoTrimHybridObject.showEditor(
|
|
106
|
+
filePath,
|
|
107
|
+
createEditorConfig({
|
|
108
|
+
...config,
|
|
109
|
+
headerTextColor: color as any,
|
|
110
|
+
}),
|
|
111
|
+
onEvent || noop
|
|
112
|
+
);
|
|
264
113
|
}
|
|
265
114
|
|
|
266
115
|
/**
|
|
@@ -269,7 +118,7 @@ export function showEditor(filePath: string, config: EditorConfig = {}): void {
|
|
|
269
118
|
* @returns {Promise<string[]>} A **Promise** which resolves to array of files
|
|
270
119
|
*/
|
|
271
120
|
export function listFiles(): Promise<string[]> {
|
|
272
|
-
return
|
|
121
|
+
return VideoTrimHybridObject.listFiles();
|
|
273
122
|
}
|
|
274
123
|
|
|
275
124
|
/**
|
|
@@ -278,7 +127,7 @@ export function listFiles(): Promise<string[]> {
|
|
|
278
127
|
* @returns {Promise} A **Promise** which resolves to number of deleted files
|
|
279
128
|
*/
|
|
280
129
|
export function cleanFiles(): Promise<number> {
|
|
281
|
-
return
|
|
130
|
+
return VideoTrimHybridObject.cleanFiles();
|
|
282
131
|
}
|
|
283
132
|
|
|
284
133
|
/**
|
|
@@ -291,14 +140,14 @@ export function deleteFile(filePath: string): Promise<boolean> {
|
|
|
291
140
|
if (!filePath?.trim().length) {
|
|
292
141
|
throw new Error('File path cannot be empty!');
|
|
293
142
|
}
|
|
294
|
-
return
|
|
143
|
+
return VideoTrimHybridObject.deleteFile(filePath);
|
|
295
144
|
}
|
|
296
145
|
|
|
297
146
|
/**
|
|
298
147
|
* Close editor
|
|
299
148
|
*/
|
|
300
|
-
export function closeEditor(): void {
|
|
301
|
-
return
|
|
149
|
+
export function closeEditor(onComplete?: () => void): void {
|
|
150
|
+
return VideoTrimHybridObject.closeEditor(onComplete || noop);
|
|
302
151
|
}
|
|
303
152
|
|
|
304
153
|
/**
|
|
@@ -306,6 +155,20 @@ export function closeEditor(): void {
|
|
|
306
155
|
*
|
|
307
156
|
* @returns {Promise} A **Promise** which resolves file info if successful
|
|
308
157
|
*/
|
|
309
|
-
export function isValidFile(url: string): Promise<
|
|
310
|
-
return
|
|
158
|
+
export function isValidFile(url: string): Promise<FileValidationResult> {
|
|
159
|
+
return VideoTrimHybridObject.isValidFile(url);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Trim a video file
|
|
164
|
+
*
|
|
165
|
+
* @param {string} url: absolute non-empty file path to edit
|
|
166
|
+
* @param {TrimOptions} options: trim options
|
|
167
|
+
* @returns {Promise<string>} A **Promise** which resolves to the trimmed file path
|
|
168
|
+
*/
|
|
169
|
+
export function trim(
|
|
170
|
+
url: string,
|
|
171
|
+
options: Partial<TrimOptions>
|
|
172
|
+
): Promise<string> {
|
|
173
|
+
return VideoTrimHybridObject.trim(url, createTrimOptions(options));
|
|
311
174
|
}
|