react-native-video-trim 6.0.12 → 6.0.13
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/ios/VideoTrim.swift +7 -6
- package/package.json +4 -1
package/ios/VideoTrim.swift
CHANGED
|
@@ -9,7 +9,6 @@ public class VideoTrim: RCTEventEmitter, AssetLoaderDelegate, UIDocumentPickerDe
|
|
|
9
9
|
// MARK: instance private props
|
|
10
10
|
private var isShowing = false
|
|
11
11
|
private var vc: VideoTrimmerViewController?
|
|
12
|
-
private var isVideoType = true
|
|
13
12
|
private var outputFile: URL?
|
|
14
13
|
private var editorConfig: NSDictionary?
|
|
15
14
|
|
|
@@ -260,7 +259,7 @@ public class VideoTrim: RCTEventEmitter, AssetLoaderDelegate, UIDocumentPickerDe
|
|
|
260
259
|
}
|
|
261
260
|
}
|
|
262
261
|
|
|
263
|
-
private func trim(viewController: VideoTrimmerViewController, inputFile: URL, videoDuration: Double, startTime: Double, endTime: Double) {
|
|
262
|
+
private func trim(viewController: VideoTrimmerViewController, inputFile: URL, videoDuration: Double, startTime: Double, endTime: Double, isVideoType: Bool) {
|
|
264
263
|
vc?.pausePlayer()
|
|
265
264
|
|
|
266
265
|
let timestamp = Int(Date().timeIntervalSince1970)
|
|
@@ -371,7 +370,7 @@ public class VideoTrim: RCTEventEmitter, AssetLoaderDelegate, UIDocumentPickerDe
|
|
|
371
370
|
let eventPayload: [String: Any] = ["outputPath": self.outputFile!.absoluteString, "startTime": (startTime * 1000).rounded(), "endTime": (endTime * 1000).rounded(), "duration": (videoDuration * 1000).rounded()]
|
|
372
371
|
self.emitEventToJS("onFinishTrimming", eventData: eventPayload)
|
|
373
372
|
|
|
374
|
-
if (self.saveToPhoto &&
|
|
373
|
+
if (self.saveToPhoto && isVideoType) {
|
|
375
374
|
PHPhotoLibrary.requestAuthorization { status in
|
|
376
375
|
guard status == .authorized else {
|
|
377
376
|
self.onError(message: "Permission to access Photo Library is not granted", code: .noPhotoPermission)
|
|
@@ -755,9 +754,11 @@ extension VideoTrim {
|
|
|
755
754
|
}
|
|
756
755
|
}
|
|
757
756
|
|
|
757
|
+
let isVideoType = (config["type"] as? String ?? "video") == "video"
|
|
758
|
+
|
|
758
759
|
vc.saveBtnClicked = {(selectedRange: CMTimeRange) in
|
|
759
760
|
if !self.enableSaveDialog {
|
|
760
|
-
self.trim(viewController: vc,inputFile: destPath, videoDuration: self.vc!.asset!.duration.seconds, startTime: selectedRange.start.seconds, endTime: selectedRange.end.seconds)
|
|
761
|
+
self.trim(viewController: vc,inputFile: destPath, videoDuration: self.vc!.asset!.duration.seconds, startTime: selectedRange.start.seconds, endTime: selectedRange.end.seconds, isVideoType: isVideoType)
|
|
761
762
|
return
|
|
762
763
|
}
|
|
763
764
|
|
|
@@ -767,7 +768,7 @@ extension VideoTrim {
|
|
|
767
768
|
|
|
768
769
|
// Create OK button with action handler
|
|
769
770
|
let ok = UIAlertAction(title: self.saveDialogConfirmText, style: .default, handler: { (action) -> Void in
|
|
770
|
-
self.trim(viewController: vc,inputFile: destPath, videoDuration: vc.asset!.duration.seconds, startTime: selectedRange.start.seconds, endTime: selectedRange.end.seconds)
|
|
771
|
+
self.trim(viewController: vc,inputFile: destPath, videoDuration: vc.asset!.duration.seconds, startTime: selectedRange.start.seconds, endTime: selectedRange.end.seconds, isVideoType: isVideoType)
|
|
771
772
|
})
|
|
772
773
|
|
|
773
774
|
// Create Cancel button with action handlder
|
|
@@ -798,7 +799,7 @@ extension VideoTrim {
|
|
|
798
799
|
// otherwise it may run too fast for local file and autoplay looks weird
|
|
799
800
|
let assetLoader = AssetLoader()
|
|
800
801
|
assetLoader.delegate = self
|
|
801
|
-
assetLoader.loadAsset(url: destPath, isVideoType:
|
|
802
|
+
assetLoader.loadAsset(url: destPath, isVideoType: isVideoType)
|
|
802
803
|
})
|
|
803
804
|
}
|
|
804
805
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-video-trim",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.13",
|
|
4
4
|
"description": "Video trimmer for your React Native app",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -88,6 +88,9 @@
|
|
|
88
88
|
"react": "*",
|
|
89
89
|
"react-native": "*"
|
|
90
90
|
},
|
|
91
|
+
"workspaces": [
|
|
92
|
+
"example"
|
|
93
|
+
],
|
|
91
94
|
"packageManager": "yarn@1.2.2",
|
|
92
95
|
"jest": {
|
|
93
96
|
"preset": "react-native",
|