react-native-video-trim 5.1.0 → 5.1.1
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 +6 -2
- package/ios/VideoTrim.mm +1 -1
- package/ios/VideoTrim.swift +7 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,9 +71,13 @@ You need to run `prebuild` in order for native code takes effect:
|
|
|
71
71
|
```
|
|
72
72
|
npx expo prebuild
|
|
73
73
|
```
|
|
74
|
-
Then you
|
|
74
|
+
Then you should to restart to make the changes take effect
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Note that on iOS, Expo Go may not work because of library linking, you may see this error:
|
|
77
|
+
|
|
78
|
+
<img src="images/expo_error.PNG" width="300" />
|
|
79
|
+
|
|
80
|
+
To avoid the error, you should open `ios/yourproject.xcworkspace` then manually build and run your app
|
|
77
81
|
|
|
78
82
|
## Usage
|
|
79
83
|
|
package/ios/VideoTrim.mm
CHANGED
package/ios/VideoTrim.swift
CHANGED
|
@@ -381,7 +381,7 @@ public class VideoTrim: NSObject, AssetLoaderDelegate, UIDocumentPickerDelegate
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
if self.closeWhenFinish {
|
|
384
|
-
self.closeEditor()
|
|
384
|
+
self.closeEditor(delay: 500)
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
} else if ReturnCode.isCancel(returnCode) {
|
|
@@ -391,7 +391,7 @@ public class VideoTrim: NSObject, AssetLoaderDelegate, UIDocumentPickerDelegate
|
|
|
391
391
|
// FAILURE
|
|
392
392
|
self.onError(message: "Command failed with state \(String(describing: FFmpegKitConfig.sessionState(toString: state ?? .failed))) and rc \(String(describing: returnCode)).\(String(describing: session?.getFailStackTrace()))", code: .trimmingFailed)
|
|
393
393
|
if self.closeWhenFinish {
|
|
394
|
-
self.closeEditor()
|
|
394
|
+
self.closeEditor(delay: 500)
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
|
|
@@ -679,10 +679,7 @@ extension VideoTrim {
|
|
|
679
679
|
if !self.enableCancelDialog {
|
|
680
680
|
self.emitEventToJS("onCancel", eventData: nil)
|
|
681
681
|
|
|
682
|
-
|
|
683
|
-
self.emitEventToJS("onHide", eventData: nil)
|
|
684
|
-
self.isShowing = false
|
|
685
|
-
})
|
|
682
|
+
self.closeEditor()
|
|
686
683
|
return
|
|
687
684
|
}
|
|
688
685
|
|
|
@@ -693,11 +690,7 @@ extension VideoTrim {
|
|
|
693
690
|
// Create OK button with action handler
|
|
694
691
|
let ok = UIAlertAction(title: self.cancelDialogConfirmText, style: .destructive, handler: { (action) -> Void in
|
|
695
692
|
self.emitEventToJS("onCancel", eventData: nil)
|
|
696
|
-
|
|
697
|
-
vc.dismiss(animated: true, completion: {
|
|
698
|
-
self.emitEventToJS("onHide", eventData: nil)
|
|
699
|
-
self.isShowing = false
|
|
700
|
-
})
|
|
693
|
+
self.closeEditor()
|
|
701
694
|
})
|
|
702
695
|
|
|
703
696
|
// Create Cancel button with action handlder
|
|
@@ -760,16 +753,15 @@ extension VideoTrim {
|
|
|
760
753
|
})
|
|
761
754
|
}
|
|
762
755
|
}
|
|
763
|
-
|
|
764
756
|
}
|
|
765
757
|
|
|
766
|
-
@objc(closeEditor)
|
|
767
|
-
public func closeEditor() {
|
|
758
|
+
@objc(closeEditor:)
|
|
759
|
+
public func closeEditor(delay: Int = 0) {
|
|
768
760
|
guard let vc = vc else { return }
|
|
769
761
|
// some how in case we trim a very short video the view controller is still visible after first .dismiss call
|
|
770
762
|
// even the file is successfully saved
|
|
771
763
|
// that's why we need a small delay here to ensure vc will be dismissed
|
|
772
|
-
DispatchQueue.main.asyncAfter(deadline: .now() +
|
|
764
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(delay)) {
|
|
773
765
|
vc.dismiss(animated: true, completion: {
|
|
774
766
|
self.emitEventToJS("onHide", eventData: nil)
|
|
775
767
|
self.isShowing = false
|