react-native-video-trim 0.0.1 → 1.0.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 (39) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +206 -0
  3. package/android/build.gradle +105 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/AndroidManifestDeprecated.xml +3 -0
  7. package/android/src/main/java/com/videotrim/VideoTrimModule.java +223 -0
  8. package/android/src/main/java/com/videotrim/VideoTrimPackage.java +28 -0
  9. package/android/src/main/java/com/videotrim/adapters/VideoTrimmerAdapter.java +60 -0
  10. package/android/src/main/java/com/videotrim/interfaces/IVideoTrimmerView.java +5 -0
  11. package/android/src/main/java/com/videotrim/interfaces/VideoTrimListener.java +7 -0
  12. package/android/src/main/java/com/videotrim/utils/StorageUtil.java +285 -0
  13. package/android/src/main/java/com/videotrim/utils/VideoTrimmerUtil.java +93 -0
  14. package/android/src/main/java/com/videotrim/widgets/RangeSeekBarView.java +534 -0
  15. package/android/src/main/java/com/videotrim/widgets/SpacesItemDecoration2.java +33 -0
  16. package/android/src/main/java/com/videotrim/widgets/VideoTrimmerView.java +443 -0
  17. package/android/src/main/java/com/videotrim/widgets/ZVideoView.java +48 -0
  18. package/android/src/main/res/drawable/ic_video_pause_black.png +0 -0
  19. package/android/src/main/res/drawable/ic_video_play_black.png +0 -0
  20. package/android/src/main/res/drawable/ic_video_thumb_handle.png +0 -0
  21. package/android/src/main/res/drawable/icon_seek_bar.png +0 -0
  22. package/android/src/main/res/layout/video_thumb_item_layout.xml +16 -0
  23. package/android/src/main/res/layout/video_trimmer_view.xml +148 -0
  24. package/android/src/main/res/values/colors.xml +17 -0
  25. package/android/src/main/res/values/strings.xml +14 -0
  26. package/ios/VideoTrim-Bridging-Header.h +2 -0
  27. package/ios/VideoTrim.mm +10 -0
  28. package/ios/VideoTrim.swift +170 -0
  29. package/ios/VideoTrim.xcodeproj/project.pbxproj +283 -0
  30. package/ios/VideoTrim.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  31. package/lib/commonjs/index.js +32 -0
  32. package/lib/commonjs/index.js.map +1 -0
  33. package/lib/module/index.js +25 -0
  34. package/lib/module/index.js.map +1 -0
  35. package/lib/typescript/index.d.ts +7 -0
  36. package/lib/typescript/index.d.ts.map +1 -0
  37. package/package.json +158 -7
  38. package/react-native-video-trim.podspec +41 -0
  39. package/src/index.tsx +35 -0
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources xmlns:tools="http://schemas.android.com/tools"
3
+ tools:ignore="MissingTranslation">
4
+ <string name="app_name">Video Trim</string>
5
+ <string name="trimmed_done">video trim completed!</string>
6
+ <string name="trimming">Trimming video...</string>
7
+ <string name="compressing">Compressing video...</string>
8
+ <string name="compressed_done">video compression completed!</string>
9
+ <string name="open_permission">Open permission</string>
10
+ <string name="video_record_des">To record a video, you need to give the camera and microphone access.</string>
11
+ <string name="recording">RECORD</string>
12
+ <string name="cancel">Cancel</string>
13
+ <string name="save">Save</string>
14
+ </resources>
@@ -0,0 +1,2 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTViewManager.h>
@@ -0,0 +1,10 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
3
+
4
+ @interface RCT_EXTERN_MODULE(VideoTrim, RCTEventEmitter)
5
+
6
+ RCT_EXTERN_METHOD(showEditor:(NSString*)uri withConfig:(NSDictionary *)config)
7
+ RCT_EXTERN_METHOD(isValidVideo:(NSString*)uri withResolver:(RCTPromiseResolveBlock)resolve
8
+ withRejecter:(RCTPromiseRejectBlock)reject)
9
+
10
+ @end
@@ -0,0 +1,170 @@
1
+ import React
2
+ import Photos
3
+
4
+ @objc(VideoTrim)
5
+ class VideoTrim: RCTEventEmitter, UIVideoEditorControllerDelegate, UINavigationControllerDelegate {
6
+ private var isShowing = false
7
+ private var mSaveToPhoto = true
8
+ private var mMaxDuration: Int?
9
+ private var hasListeners = false
10
+
11
+ @objc
12
+ static override func requiresMainQueueSetup() -> Bool {
13
+ return true
14
+ }
15
+
16
+ override func supportedEvents() -> [String]! {
17
+ return ["VideoTrim"]
18
+ }
19
+
20
+ override func startObserving() {
21
+ hasListeners = true
22
+ }
23
+
24
+ override func stopObserving() {
25
+ hasListeners = false
26
+ }
27
+
28
+ @objc(isValidVideo:withResolver:withRejecter:)
29
+ func isValidVideo(uri: String, resolve: @escaping RCTPromiseResolveBlock,reject: @escaping RCTPromiseRejectBlock) -> Void {
30
+ if let destPath = copyFileToDocumentDir(uri: uri) {
31
+ resolve(UIVideoEditorController.canEditVideo(atPath: destPath))
32
+ } else {
33
+ resolve(false)
34
+ }
35
+ }
36
+
37
+ @objc(showEditor:withConfig:)
38
+ func showEditor(uri: String, config: NSDictionary){
39
+ if isShowing {
40
+ return
41
+ }
42
+
43
+ if let saveToPhoto = config["saveToPhoto"] as? Bool {
44
+ self.mSaveToPhoto = saveToPhoto
45
+ }
46
+
47
+ if let maxDuration = config["maxDuration"] as? Int {
48
+ self.mMaxDuration = maxDuration
49
+ }
50
+
51
+ if let destPath = copyFileToDocumentDir(uri: uri) {
52
+ if UIVideoEditorController.canEditVideo(atPath: destPath) {
53
+ DispatchQueue.main.async {
54
+ let editController = UIVideoEditorController()
55
+ editController.videoPath = destPath
56
+ editController.videoQuality = .typeHigh
57
+
58
+ if (self.mMaxDuration != nil) {
59
+ editController.videoMaximumDuration = Double(self.mMaxDuration!)
60
+ }
61
+
62
+ editController.delegate = self
63
+ if let root = RCTPresentedViewController() {
64
+ root.present(editController, animated: true, completion: {
65
+ self.emitEventToJS("onShow", eventData: nil)
66
+ self.isShowing = true
67
+ })
68
+ }
69
+ }
70
+ } else {
71
+ let eventPayload: [String: Any] = ["message": "File is not a valid video"]
72
+ self.emitEventToJS("onError", eventData: eventPayload)
73
+ }
74
+ } else {
75
+ let eventPayload: [String: Any] = ["message": "File is invalid"]
76
+ self.emitEventToJS("onError", eventData: eventPayload)
77
+ }
78
+ }
79
+
80
+ func videoEditorController(_ editor: UIVideoEditorController,
81
+ didSaveEditedVideoToPath editedVideoPath: String) {
82
+ let eventPayload: [String: Any] = ["outputPath": editedVideoPath]
83
+ self.emitEventToJS("onFinishTrimming", eventData: eventPayload)
84
+
85
+ if (mSaveToPhoto) {
86
+ PHPhotoLibrary.requestAuthorization { status in
87
+ guard status == .authorized else {
88
+ let eventPayload: [String: Any] = ["message": "Permission to access Photo Library is not granted"]
89
+ self.emitEventToJS("onError", eventData: eventPayload)
90
+ return
91
+ }
92
+
93
+ PHPhotoLibrary.shared().performChanges({
94
+ let request = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: URL(fileURLWithPath: editedVideoPath))
95
+ request?.creationDate = Date()
96
+ }) { success, error in
97
+ if success {
98
+ print("Edited video saved to Photo Library successfully.")
99
+ } else {
100
+ let eventPayload: [String: Any] = ["message": "Failed to save edited video to Photo Library: \(error?.localizedDescription ?? "Unknown error")"]
101
+ self.emitEventToJS("onError", eventData: eventPayload)
102
+ }
103
+ }
104
+ }
105
+ }
106
+
107
+ // the edit has a known bug where it fires "didSaveEditedVideoToPath" twice, so we have to set its delete to nil right after first call
108
+ editor.delegate = nil
109
+
110
+
111
+ editor.dismiss(animated: true, completion: {
112
+ self.emitEventToJS("onHide", eventData: nil)
113
+ self.isShowing = false
114
+ })
115
+ }
116
+
117
+ func videoEditorControllerDidCancel(_ editor: UIVideoEditorController) {
118
+ self.emitEventToJS("onCancelTrimming", eventData: nil)
119
+ editor.dismiss(animated: true, completion: {
120
+ self.emitEventToJS("onHide", eventData: nil)
121
+ self.isShowing = false
122
+ })
123
+ }
124
+
125
+ func videoEditorController(_ editor: UIVideoEditorController,
126
+ didFailWithError error: Error) {
127
+ let eventPayload: [String: Any] = ["message": error.localizedDescription]
128
+ self.emitEventToJS("onError", eventData: eventPayload)
129
+ editor.dismiss(animated: true, completion: {
130
+ self.emitEventToJS("onHide", eventData: nil)
131
+ self.isShowing = false
132
+ })
133
+ }
134
+
135
+
136
+ private func copyFileToDocumentDir(uri: String) -> String? {
137
+ if let videoURL = URL(string: uri) {
138
+ // Save the video to the document directory
139
+ let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
140
+ // Extract the file extension from the videoURL
141
+ let fileExtension = videoURL.pathExtension
142
+
143
+ // Define the filename with the correct file extension
144
+ let destinationURL = documentsDirectory.appendingPathComponent("editedVideo.\(fileExtension)")
145
+
146
+ do {
147
+ // Remove the old file if it exists
148
+ if FileManager.default.fileExists(atPath: destinationURL.path) {
149
+ try FileManager.default.removeItem(at: destinationURL)
150
+ }
151
+
152
+ try FileManager.default.copyItem(at: videoURL, to: destinationURL)
153
+ } catch {
154
+ return nil
155
+ }
156
+
157
+ return destinationURL.path
158
+ } else {
159
+ return nil
160
+ }
161
+ }
162
+
163
+ private func emitEventToJS(_ eventName: String, eventData: [String: Any]?) {
164
+ if hasListeners {
165
+ var modifiedEventData = eventData ?? [:] // If eventData is nil, create an empty dictionary
166
+ modifiedEventData["name"] = eventName
167
+ sendEvent(withName: "VideoTrim", body: modifiedEventData)
168
+ }
169
+ }
170
+ }
@@ -0,0 +1,283 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXBuildFile section */
10
+ 5E555C0D2413F4C50049A1A2 /* VideoTrim.mm in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* VideoTrim.mm */; };
11
+ F4FF95D7245B92E800C19C63 /* VideoTrim.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* VideoTrim.swift */; };
12
+ /* End PBXBuildFile section */
13
+
14
+ /* Begin PBXCopyFilesBuildPhase section */
15
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
16
+ isa = PBXCopyFilesBuildPhase;
17
+ buildActionMask = 2147483647;
18
+ dstPath = "include/$(PRODUCT_NAME)";
19
+ dstSubfolderSpec = 16;
20
+ files = (
21
+ );
22
+ runOnlyForDeploymentPostprocessing = 0;
23
+ };
24
+ /* End PBXCopyFilesBuildPhase section */
25
+
26
+ /* Begin PBXFileReference section */
27
+ 134814201AA4EA6300B7C361 /* libVideoTrim.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libVideoTrim.a; sourceTree = BUILT_PRODUCTS_DIR; };
28
+ B3E7B5891CC2AC0600A0062D /* VideoTrim.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VideoTrim.mm; sourceTree = "<group>"; };
29
+ F4FF95D5245B92E700C19C63 /* VideoTrim-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "VideoTrim-Bridging-Header.h"; sourceTree = "<group>"; };
30
+ F4FF95D6245B92E800C19C63 /* VideoTrim.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoTrim.swift; sourceTree = "<group>"; };
31
+ /* End PBXFileReference section */
32
+
33
+ /* Begin PBXFrameworksBuildPhase section */
34
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
35
+ isa = PBXFrameworksBuildPhase;
36
+ buildActionMask = 2147483647;
37
+ files = (
38
+ );
39
+ runOnlyForDeploymentPostprocessing = 0;
40
+ };
41
+ /* End PBXFrameworksBuildPhase section */
42
+
43
+ /* Begin PBXGroup section */
44
+ 134814211AA4EA7D00B7C361 /* Products */ = {
45
+ isa = PBXGroup;
46
+ children = (
47
+ 134814201AA4EA6300B7C361 /* libVideoTrim.a */,
48
+ );
49
+ name = Products;
50
+ sourceTree = "<group>";
51
+ };
52
+ 58B511D21A9E6C8500147676 = {
53
+ isa = PBXGroup;
54
+ children = (
55
+ F4FF95D6245B92E800C19C63 /* VideoTrim.swift */,
56
+ B3E7B5891CC2AC0600A0062D /* VideoTrim.mm */,
57
+ F4FF95D5245B92E700C19C63 /* VideoTrim-Bridging-Header.h */,
58
+ 134814211AA4EA7D00B7C361 /* Products */,
59
+ );
60
+ sourceTree = "<group>";
61
+ };
62
+ /* End PBXGroup section */
63
+
64
+ /* Begin PBXNativeTarget section */
65
+ 58B511DA1A9E6C8500147676 /* VideoTrim */ = {
66
+ isa = PBXNativeTarget;
67
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "VideoTrim" */;
68
+ buildPhases = (
69
+ 58B511D71A9E6C8500147676 /* Sources */,
70
+ 58B511D81A9E6C8500147676 /* Frameworks */,
71
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
72
+ );
73
+ buildRules = (
74
+ );
75
+ dependencies = (
76
+ );
77
+ name = VideoTrim;
78
+ productName = RCTDataManager;
79
+ productReference = 134814201AA4EA6300B7C361 /* libVideoTrim.a */;
80
+ productType = "com.apple.product-type.library.static";
81
+ };
82
+ /* End PBXNativeTarget section */
83
+
84
+ /* Begin PBXProject section */
85
+ 58B511D31A9E6C8500147676 /* Project object */ = {
86
+ isa = PBXProject;
87
+ attributes = {
88
+ LastUpgradeCheck = 0920;
89
+ ORGANIZATIONNAME = Facebook;
90
+ TargetAttributes = {
91
+ 58B511DA1A9E6C8500147676 = {
92
+ CreatedOnToolsVersion = 6.1.1;
93
+ };
94
+ };
95
+ };
96
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "VideoTrim" */;
97
+ compatibilityVersion = "Xcode 3.2";
98
+ developmentRegion = English;
99
+ hasScannedForEncodings = 0;
100
+ knownRegions = (
101
+ English,
102
+ en,
103
+ );
104
+ mainGroup = 58B511D21A9E6C8500147676;
105
+ productRefGroup = 58B511D21A9E6C8500147676;
106
+ projectDirPath = "";
107
+ projectRoot = "";
108
+ targets = (
109
+ 58B511DA1A9E6C8500147676 /* VideoTrim */,
110
+ );
111
+ };
112
+ /* End PBXProject section */
113
+
114
+ /* Begin PBXSourcesBuildPhase section */
115
+ 58B511D71A9E6C8500147676 /* Sources */ = {
116
+ isa = PBXSourcesBuildPhase;
117
+ buildActionMask = 2147483647;
118
+ files = (
119
+ F4FF95D7245B92E800C19C63 /* VideoTrim.swift in Sources */,
120
+ B3E7B58A1CC2AC0600A0062D /* VideoTrim.mm in Sources */,
121
+ );
122
+ runOnlyForDeploymentPostprocessing = 0;
123
+ };
124
+ /* End PBXSourcesBuildPhase section */
125
+
126
+ /* Begin XCBuildConfiguration section */
127
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
128
+ isa = XCBuildConfiguration;
129
+ buildSettings = {
130
+ ALWAYS_SEARCH_USER_PATHS = NO;
131
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
132
+ CLANG_CXX_LIBRARY = "libc++";
133
+ CLANG_ENABLE_MODULES = YES;
134
+ CLANG_ENABLE_OBJC_ARC = YES;
135
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
136
+ CLANG_WARN_BOOL_CONVERSION = YES;
137
+ CLANG_WARN_COMMA = YES;
138
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
139
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
140
+ CLANG_WARN_EMPTY_BODY = YES;
141
+ CLANG_WARN_ENUM_CONVERSION = YES;
142
+ CLANG_WARN_INFINITE_RECURSION = YES;
143
+ CLANG_WARN_INT_CONVERSION = YES;
144
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
145
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
146
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
147
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
148
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
149
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
150
+ CLANG_WARN_UNREACHABLE_CODE = YES;
151
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
152
+ COPY_PHASE_STRIP = NO;
153
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
154
+ ENABLE_TESTABILITY = YES;
155
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
156
+ GCC_C_LANGUAGE_STANDARD = gnu99;
157
+ GCC_DYNAMIC_NO_PIC = NO;
158
+ GCC_NO_COMMON_BLOCKS = YES;
159
+ GCC_OPTIMIZATION_LEVEL = 0;
160
+ GCC_PREPROCESSOR_DEFINITIONS = (
161
+ "DEBUG=1",
162
+ "$(inherited)",
163
+ );
164
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
165
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
166
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
167
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
168
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
169
+ GCC_WARN_UNUSED_FUNCTION = YES;
170
+ GCC_WARN_UNUSED_VARIABLE = YES;
171
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
172
+ MTL_ENABLE_DEBUG_INFO = YES;
173
+ ONLY_ACTIVE_ARCH = YES;
174
+ SDKROOT = iphoneos;
175
+ };
176
+ name = Debug;
177
+ };
178
+ 58B511EE1A9E6C8500147676 /* Release */ = {
179
+ isa = XCBuildConfiguration;
180
+ buildSettings = {
181
+ ALWAYS_SEARCH_USER_PATHS = NO;
182
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
183
+ CLANG_CXX_LIBRARY = "libc++";
184
+ CLANG_ENABLE_MODULES = YES;
185
+ CLANG_ENABLE_OBJC_ARC = YES;
186
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
187
+ CLANG_WARN_BOOL_CONVERSION = YES;
188
+ CLANG_WARN_COMMA = YES;
189
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
190
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
191
+ CLANG_WARN_EMPTY_BODY = YES;
192
+ CLANG_WARN_ENUM_CONVERSION = YES;
193
+ CLANG_WARN_INFINITE_RECURSION = YES;
194
+ CLANG_WARN_INT_CONVERSION = YES;
195
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
196
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
197
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
198
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
199
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
200
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
201
+ CLANG_WARN_UNREACHABLE_CODE = YES;
202
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
203
+ COPY_PHASE_STRIP = YES;
204
+ ENABLE_NS_ASSERTIONS = NO;
205
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
206
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
207
+ GCC_C_LANGUAGE_STANDARD = gnu99;
208
+ GCC_NO_COMMON_BLOCKS = YES;
209
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
210
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
211
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
212
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
213
+ GCC_WARN_UNUSED_FUNCTION = YES;
214
+ GCC_WARN_UNUSED_VARIABLE = YES;
215
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
216
+ MTL_ENABLE_DEBUG_INFO = NO;
217
+ SDKROOT = iphoneos;
218
+ VALIDATE_PRODUCT = YES;
219
+ };
220
+ name = Release;
221
+ };
222
+ 58B511F01A9E6C8500147676 /* Debug */ = {
223
+ isa = XCBuildConfiguration;
224
+ buildSettings = {
225
+ HEADER_SEARCH_PATHS = (
226
+ "$(inherited)",
227
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
228
+ "$(SRCROOT)/../../../React/**",
229
+ "$(SRCROOT)/../../react-native/React/**",
230
+ );
231
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
232
+ OTHER_LDFLAGS = "-ObjC";
233
+ PRODUCT_NAME = VideoTrim;
234
+ SKIP_INSTALL = YES;
235
+ SWIFT_OBJC_BRIDGING_HEADER = "VideoTrim-Bridging-Header.h";
236
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
237
+ SWIFT_VERSION = 5.0;
238
+ };
239
+ name = Debug;
240
+ };
241
+ 58B511F11A9E6C8500147676 /* Release */ = {
242
+ isa = XCBuildConfiguration;
243
+ buildSettings = {
244
+ HEADER_SEARCH_PATHS = (
245
+ "$(inherited)",
246
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
247
+ "$(SRCROOT)/../../../React/**",
248
+ "$(SRCROOT)/../../react-native/React/**",
249
+ );
250
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
251
+ OTHER_LDFLAGS = "-ObjC";
252
+ PRODUCT_NAME = VideoTrim;
253
+ SKIP_INSTALL = YES;
254
+ SWIFT_OBJC_BRIDGING_HEADER = "VideoTrim-Bridging-Header.h";
255
+ SWIFT_VERSION = 5.0;
256
+ };
257
+ name = Release;
258
+ };
259
+ /* End XCBuildConfiguration section */
260
+
261
+ /* Begin XCConfigurationList section */
262
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "VideoTrim" */ = {
263
+ isa = XCConfigurationList;
264
+ buildConfigurations = (
265
+ 58B511ED1A9E6C8500147676 /* Debug */,
266
+ 58B511EE1A9E6C8500147676 /* Release */,
267
+ );
268
+ defaultConfigurationIsVisible = 0;
269
+ defaultConfigurationName = Release;
270
+ };
271
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "VideoTrim" */ = {
272
+ isa = XCConfigurationList;
273
+ buildConfigurations = (
274
+ 58B511F01A9E6C8500147676 /* Debug */,
275
+ 58B511F11A9E6C8500147676 /* Release */,
276
+ );
277
+ defaultConfigurationIsVisible = 0;
278
+ defaultConfigurationName = Release;
279
+ };
280
+ /* End XCConfigurationList section */
281
+ };
282
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
283
+ }
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ </Workspace>
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isValidVideo = isValidVideo;
7
+ exports.showEditor = showEditor;
8
+ var _reactNative = require("react-native");
9
+ const LINKING_ERROR = `The package 'react-native-video-trim' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
10
+ ios: "- You have run 'pod install'\n",
11
+ default: ''
12
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
13
+ const VideoTrim = _reactNative.NativeModules.VideoTrim ? _reactNative.NativeModules.VideoTrim : new Proxy({}, {
14
+ get() {
15
+ throw new Error(LINKING_ERROR);
16
+ }
17
+ });
18
+ function showEditor(videoPath) {
19
+ let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
+ const {
21
+ maxDuration,
22
+ saveToPhoto = true
23
+ } = config;
24
+ VideoTrim.showEditor(videoPath, {
25
+ saveToPhoto,
26
+ maxDuration
27
+ });
28
+ }
29
+ function isValidVideo(videoPath) {
30
+ return VideoTrim.isValidVideo(videoPath);
31
+ }
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","VideoTrim","NativeModules","Proxy","get","Error","showEditor","videoPath","config","arguments","length","undefined","maxDuration","saveToPhoto","isValidVideo"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAChB,kFAAiF,GAClFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,SAAS,GAAGC,0BAAa,CAACD,SAAS,GACrCC,0BAAa,CAACD,SAAS,GACvB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAOE,SAASU,UAAUA,CAACC,SAAiB,EAAmC;EAAA,IAAjCC,MAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACrE,MAAM;IAAEG,WAAW;IAAEC,WAAW,GAAG;EAAK,CAAC,GAAGL,MAAM;EAClDP,SAAS,CAACK,UAAU,CAACC,SAAS,EAAE;IAC9BM,WAAW;IACXD;EACF,CAAC,CAAC;AACJ;AAEO,SAASE,YAAYA,CAACP,SAAiB,EAAoB;EAChE,OAAON,SAAS,CAACa,YAAY,CAACP,SAAS,CAAC;AAC1C"}
@@ -0,0 +1,25 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package 'react-native-video-trim' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install'\n",
4
+ default: ''
5
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
6
+ const VideoTrim = NativeModules.VideoTrim ? NativeModules.VideoTrim : new Proxy({}, {
7
+ get() {
8
+ throw new Error(LINKING_ERROR);
9
+ }
10
+ });
11
+ export function showEditor(videoPath) {
12
+ let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13
+ const {
14
+ maxDuration,
15
+ saveToPhoto = true
16
+ } = config;
17
+ VideoTrim.showEditor(videoPath, {
18
+ saveToPhoto,
19
+ maxDuration
20
+ });
21
+ }
22
+ export function isValidVideo(videoPath) {
23
+ return VideoTrim.isValidVideo(videoPath);
24
+ }
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","VideoTrim","Proxy","get","Error","showEditor","videoPath","config","arguments","length","undefined","maxDuration","saveToPhoto","isValidVideo"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,kFAAiF,GAClFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,SAAS,GAAGN,aAAa,CAACM,SAAS,GACrCN,aAAa,CAACM,SAAS,GACvB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAOL,OAAO,SAASQ,UAAUA,CAACC,SAAiB,EAAmC;EAAA,IAAjCC,MAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACrE,MAAM;IAAEG,WAAW;IAAEC,WAAW,GAAG;EAAK,CAAC,GAAGL,MAAM;EAClDN,SAAS,CAACI,UAAU,CAACC,SAAS,EAAE;IAC9BM,WAAW;IACXD;EACF,CAAC,CAAC;AACJ;AAEA,OAAO,SAASE,YAAYA,CAACP,SAAiB,EAAoB;EAChE,OAAOL,SAAS,CAACY,YAAY,CAACP,SAAS,CAAC;AAC1C"}
@@ -0,0 +1,7 @@
1
+ export interface EditorConfig {
2
+ saveToPhoto?: boolean;
3
+ maxDuration?: number;
4
+ }
5
+ export declare function showEditor(videoPath: string, config?: EditorConfig): void;
6
+ export declare function isValidVideo(videoPath: string): Promise<boolean>;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,YAAiB,GAAG,IAAI,CAM7E;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEhE"}