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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridVideoTrimSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridVideoTrimSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::videotrim {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridVideoTrimSpec: public jni::HybridClass<JHybridVideoTrimSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridVideoTrimSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videotrim/HybridVideoTrimSpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridVideoTrimSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridVideoTrimSpec::TAG),
|
|
32
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
~JHybridVideoTrimSpec() override {
|
|
36
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
37
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
size_t getExternalMemorySize() noexcept override;
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
inline const jni::global_ref<JHybridVideoTrimSpec::javaobject>& getJavaPart() const noexcept {
|
|
45
|
+
return _javaPart;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
// Properties
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Methods
|
|
54
|
+
void showEditor(const std::string& filePath, const EditorConfig& config, const std::function<void(const std::string& /* eventName */, const std::unordered_map<std::string, std::string>& /* payload */)>& onEvent) override;
|
|
55
|
+
std::shared_ptr<Promise<std::vector<std::string>>> listFiles() override;
|
|
56
|
+
std::shared_ptr<Promise<double>> cleanFiles() override;
|
|
57
|
+
std::shared_ptr<Promise<bool>> deleteFile(const std::string& filePath) override;
|
|
58
|
+
void closeEditor(const std::function<void()>& onComplete) override;
|
|
59
|
+
std::shared_ptr<Promise<FileValidationResult>> isValidFile(const std::string& url) override;
|
|
60
|
+
std::shared_ptr<Promise<std::string>> trim(const std::string& url, const TrimOptions& options) override;
|
|
61
|
+
|
|
62
|
+
private:
|
|
63
|
+
friend HybridBase;
|
|
64
|
+
using HybridBase::HybridBase;
|
|
65
|
+
jni::global_ref<JHybridVideoTrimSpec::javaobject> _javaPart;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} // namespace margelo::nitro::videotrim
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JTrimOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "TrimOptions.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::videotrim {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "TrimOptions" and the the Kotlin data class "TrimOptions".
|
|
21
|
+
*/
|
|
22
|
+
struct JTrimOptions final: public jni::JavaClass<JTrimOptions> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videotrim/TrimOptions;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct TrimOptions by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
TrimOptions toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldStartTime = clazz->getField<double>("startTime");
|
|
35
|
+
double startTime = this->getFieldValue(fieldStartTime);
|
|
36
|
+
static const auto fieldEndTime = clazz->getField<double>("endTime");
|
|
37
|
+
double endTime = this->getFieldValue(fieldEndTime);
|
|
38
|
+
static const auto fieldSaveToPhoto = clazz->getField<jboolean>("saveToPhoto");
|
|
39
|
+
jboolean saveToPhoto = this->getFieldValue(fieldSaveToPhoto);
|
|
40
|
+
static const auto fieldType = clazz->getField<jni::JString>("type");
|
|
41
|
+
jni::local_ref<jni::JString> type = this->getFieldValue(fieldType);
|
|
42
|
+
static const auto fieldOutputExt = clazz->getField<jni::JString>("outputExt");
|
|
43
|
+
jni::local_ref<jni::JString> outputExt = this->getFieldValue(fieldOutputExt);
|
|
44
|
+
static const auto fieldOpenDocumentsOnFinish = clazz->getField<jboolean>("openDocumentsOnFinish");
|
|
45
|
+
jboolean openDocumentsOnFinish = this->getFieldValue(fieldOpenDocumentsOnFinish);
|
|
46
|
+
static const auto fieldOpenShareSheetOnFinish = clazz->getField<jboolean>("openShareSheetOnFinish");
|
|
47
|
+
jboolean openShareSheetOnFinish = this->getFieldValue(fieldOpenShareSheetOnFinish);
|
|
48
|
+
static const auto fieldRemoveAfterSavedToPhoto = clazz->getField<jboolean>("removeAfterSavedToPhoto");
|
|
49
|
+
jboolean removeAfterSavedToPhoto = this->getFieldValue(fieldRemoveAfterSavedToPhoto);
|
|
50
|
+
static const auto fieldRemoveAfterFailedToSavePhoto = clazz->getField<jboolean>("removeAfterFailedToSavePhoto");
|
|
51
|
+
jboolean removeAfterFailedToSavePhoto = this->getFieldValue(fieldRemoveAfterFailedToSavePhoto);
|
|
52
|
+
static const auto fieldRemoveAfterSavedToDocuments = clazz->getField<jboolean>("removeAfterSavedToDocuments");
|
|
53
|
+
jboolean removeAfterSavedToDocuments = this->getFieldValue(fieldRemoveAfterSavedToDocuments);
|
|
54
|
+
static const auto fieldRemoveAfterFailedToSaveDocuments = clazz->getField<jboolean>("removeAfterFailedToSaveDocuments");
|
|
55
|
+
jboolean removeAfterFailedToSaveDocuments = this->getFieldValue(fieldRemoveAfterFailedToSaveDocuments);
|
|
56
|
+
static const auto fieldRemoveAfterShared = clazz->getField<jboolean>("removeAfterShared");
|
|
57
|
+
jboolean removeAfterShared = this->getFieldValue(fieldRemoveAfterShared);
|
|
58
|
+
static const auto fieldRemoveAfterFailedToShare = clazz->getField<jboolean>("removeAfterFailedToShare");
|
|
59
|
+
jboolean removeAfterFailedToShare = this->getFieldValue(fieldRemoveAfterFailedToShare);
|
|
60
|
+
static const auto fieldEnableRotation = clazz->getField<jboolean>("enableRotation");
|
|
61
|
+
jboolean enableRotation = this->getFieldValue(fieldEnableRotation);
|
|
62
|
+
static const auto fieldRotationAngle = clazz->getField<double>("rotationAngle");
|
|
63
|
+
double rotationAngle = this->getFieldValue(fieldRotationAngle);
|
|
64
|
+
return TrimOptions(
|
|
65
|
+
startTime,
|
|
66
|
+
endTime,
|
|
67
|
+
static_cast<bool>(saveToPhoto),
|
|
68
|
+
type->toStdString(),
|
|
69
|
+
outputExt->toStdString(),
|
|
70
|
+
static_cast<bool>(openDocumentsOnFinish),
|
|
71
|
+
static_cast<bool>(openShareSheetOnFinish),
|
|
72
|
+
static_cast<bool>(removeAfterSavedToPhoto),
|
|
73
|
+
static_cast<bool>(removeAfterFailedToSavePhoto),
|
|
74
|
+
static_cast<bool>(removeAfterSavedToDocuments),
|
|
75
|
+
static_cast<bool>(removeAfterFailedToSaveDocuments),
|
|
76
|
+
static_cast<bool>(removeAfterShared),
|
|
77
|
+
static_cast<bool>(removeAfterFailedToShare),
|
|
78
|
+
static_cast<bool>(enableRotation),
|
|
79
|
+
rotationAngle
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public:
|
|
84
|
+
/**
|
|
85
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
86
|
+
*/
|
|
87
|
+
[[maybe_unused]]
|
|
88
|
+
static jni::local_ref<JTrimOptions::javaobject> fromCpp(const TrimOptions& value) {
|
|
89
|
+
return newInstance(
|
|
90
|
+
value.startTime,
|
|
91
|
+
value.endTime,
|
|
92
|
+
value.saveToPhoto,
|
|
93
|
+
jni::make_jstring(value.type),
|
|
94
|
+
jni::make_jstring(value.outputExt),
|
|
95
|
+
value.openDocumentsOnFinish,
|
|
96
|
+
value.openShareSheetOnFinish,
|
|
97
|
+
value.removeAfterSavedToPhoto,
|
|
98
|
+
value.removeAfterFailedToSavePhoto,
|
|
99
|
+
value.removeAfterSavedToDocuments,
|
|
100
|
+
value.removeAfterFailedToSaveDocuments,
|
|
101
|
+
value.removeAfterShared,
|
|
102
|
+
value.removeAfterFailedToShare,
|
|
103
|
+
value.enableRotation,
|
|
104
|
+
value.rotationAngle
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
} // namespace margelo::nitro::videotrim
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// EditorConfig.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.videotrim
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "EditorConfig".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class EditorConfig
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
constructor(
|
|
23
|
+
val enableHapticFeedback: Boolean,
|
|
24
|
+
val maxDuration: Double,
|
|
25
|
+
val minDuration: Double,
|
|
26
|
+
val cancelButtonText: String,
|
|
27
|
+
val saveButtonText: String,
|
|
28
|
+
val enableCancelDialog: Boolean,
|
|
29
|
+
val cancelDialogTitle: String,
|
|
30
|
+
val cancelDialogMessage: String,
|
|
31
|
+
val cancelDialogCancelText: String,
|
|
32
|
+
val cancelDialogConfirmText: String,
|
|
33
|
+
val enableSaveDialog: Boolean,
|
|
34
|
+
val saveDialogTitle: String,
|
|
35
|
+
val saveDialogMessage: String,
|
|
36
|
+
val saveDialogCancelText: String,
|
|
37
|
+
val saveDialogConfirmText: String,
|
|
38
|
+
val trimmingText: String,
|
|
39
|
+
val fullScreenModalIOS: Boolean,
|
|
40
|
+
val autoplay: Boolean,
|
|
41
|
+
val jumpToPositionOnLoad: Double,
|
|
42
|
+
val closeWhenFinish: Boolean,
|
|
43
|
+
val enableCancelTrimming: Boolean,
|
|
44
|
+
val cancelTrimmingButtonText: String,
|
|
45
|
+
val enableCancelTrimmingDialog: Boolean,
|
|
46
|
+
val cancelTrimmingDialogTitle: String,
|
|
47
|
+
val cancelTrimmingDialogMessage: String,
|
|
48
|
+
val cancelTrimmingDialogCancelText: String,
|
|
49
|
+
val cancelTrimmingDialogConfirmText: String,
|
|
50
|
+
val headerText: String,
|
|
51
|
+
val headerTextSize: Double,
|
|
52
|
+
val headerTextColor: Double,
|
|
53
|
+
val alertOnFailToLoad: Boolean,
|
|
54
|
+
val alertOnFailTitle: String,
|
|
55
|
+
val alertOnFailMessage: String,
|
|
56
|
+
val alertOnFailCloseText: String,
|
|
57
|
+
val saveToPhoto: Boolean,
|
|
58
|
+
val type: String,
|
|
59
|
+
val outputExt: String,
|
|
60
|
+
val openDocumentsOnFinish: Boolean,
|
|
61
|
+
val openShareSheetOnFinish: Boolean,
|
|
62
|
+
val removeAfterSavedToPhoto: Boolean,
|
|
63
|
+
val removeAfterFailedToSavePhoto: Boolean,
|
|
64
|
+
val removeAfterSavedToDocuments: Boolean,
|
|
65
|
+
val removeAfterFailedToSaveDocuments: Boolean,
|
|
66
|
+
val removeAfterShared: Boolean,
|
|
67
|
+
val removeAfterFailedToShare: Boolean,
|
|
68
|
+
val enableRotation: Boolean,
|
|
69
|
+
val rotationAngle: Double
|
|
70
|
+
) {
|
|
71
|
+
/* main constructor */
|
|
72
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FileValidationResult.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.videotrim
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "FileValidationResult".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class FileValidationResult
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
constructor(
|
|
23
|
+
val isValid: Boolean,
|
|
24
|
+
val fileType: String,
|
|
25
|
+
val duration: Double
|
|
26
|
+
) {
|
|
27
|
+
/* main constructor */
|
|
28
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.videotrim
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.*
|
|
14
|
+
import dalvik.annotation.optimization.FastNative
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `() => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void: () -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `() => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_cxx: Func_void {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(): Unit
|
|
60
|
+
= invoke_cxx()
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `() => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `() -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_java(private val function: () -> Unit): Func_void {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(): Unit {
|
|
78
|
+
return this.function()
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string_std__unordered_map_std__string__std__string_.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.videotrim
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.*
|
|
14
|
+
import dalvik.annotation.optimization.FastNative
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(eventName: string, payload: record) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_std__string_std__unordered_map_std__string__std__string_: (String, Map<String, String>) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(eventName: String, payload: Map<String, String>): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(eventName: string, payload: record) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_std__string_std__unordered_map_std__string__std__string__cxx: Func_void_std__string_std__unordered_map_std__string__std__string_ {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(eventName: String, payload: Map<String, String>): Unit
|
|
60
|
+
= invoke_cxx(eventName,payload)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(eventName: String, payload: Map<String, String>): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(eventName: string, payload: record) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(String, Map<String, String>) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_std__string_std__unordered_map_std__string__std__string__java(private val function: (String, Map<String, String>) -> Unit): Func_void_std__string_std__unordered_map_std__string__std__string_ {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(eventName: String, payload: Map<String, String>): Unit {
|
|
78
|
+
return this.function(eventName, payload)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridVideoTrimSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.videotrim
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.*
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Kotlin class representing the VideoTrim HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of VideoTrim.
|
|
18
|
+
*/
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
@Keep
|
|
21
|
+
@Suppress(
|
|
22
|
+
"KotlinJniMissingFunction", "unused",
|
|
23
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
+
)
|
|
26
|
+
abstract class HybridVideoTrimSpec: HybridObject() {
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
private var mHybridData: HybridData = initHybrid()
|
|
29
|
+
|
|
30
|
+
init {
|
|
31
|
+
super.updateNative(mHybridData)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun updateNative(hybridData: HybridData) {
|
|
35
|
+
mHybridData = hybridData
|
|
36
|
+
super.updateNative(hybridData)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Properties
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// Methods
|
|
43
|
+
abstract fun showEditor(filePath: String, config: EditorConfig, onEvent: (eventName: String, payload: Map<String, String>) -> Unit): Unit
|
|
44
|
+
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
@Keep
|
|
47
|
+
private fun showEditor_cxx(filePath: String, config: EditorConfig, onEvent: Func_void_std__string_std__unordered_map_std__string__std__string_): Unit {
|
|
48
|
+
val __result = showEditor(filePath, config, onEvent)
|
|
49
|
+
return __result
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
@Keep
|
|
54
|
+
abstract fun listFiles(): Promise<Array<String>>
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
abstract fun cleanFiles(): Promise<Double>
|
|
59
|
+
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
abstract fun deleteFile(filePath: String): Promise<Boolean>
|
|
63
|
+
|
|
64
|
+
abstract fun closeEditor(onComplete: () -> Unit): Unit
|
|
65
|
+
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
private fun closeEditor_cxx(onComplete: Func_void): Unit {
|
|
69
|
+
val __result = closeEditor(onComplete)
|
|
70
|
+
return __result
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
abstract fun isValidFile(url: String): Promise<FileValidationResult>
|
|
76
|
+
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
@Keep
|
|
79
|
+
abstract fun trim(url: String, options: TrimOptions): Promise<String>
|
|
80
|
+
|
|
81
|
+
private external fun initHybrid(): HybridData
|
|
82
|
+
|
|
83
|
+
companion object {
|
|
84
|
+
private const val TAG = "HybridVideoTrimSpec"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TrimOptions.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.videotrim
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "TrimOptions".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class TrimOptions
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
constructor(
|
|
23
|
+
val startTime: Double,
|
|
24
|
+
val endTime: Double,
|
|
25
|
+
val saveToPhoto: Boolean,
|
|
26
|
+
val type: String,
|
|
27
|
+
val outputExt: String,
|
|
28
|
+
val openDocumentsOnFinish: Boolean,
|
|
29
|
+
val openShareSheetOnFinish: Boolean,
|
|
30
|
+
val removeAfterSavedToPhoto: Boolean,
|
|
31
|
+
val removeAfterFailedToSavePhoto: Boolean,
|
|
32
|
+
val removeAfterSavedToDocuments: Boolean,
|
|
33
|
+
val removeAfterFailedToSaveDocuments: Boolean,
|
|
34
|
+
val removeAfterShared: Boolean,
|
|
35
|
+
val removeAfterFailedToShare: Boolean,
|
|
36
|
+
val enableRotation: Boolean,
|
|
37
|
+
val rotationAngle: Double
|
|
38
|
+
) {
|
|
39
|
+
/* main constructor */
|
|
40
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// videotrimOnLoad.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.videotrim
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class videotrimOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "videotrimOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "videotrim".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading videotrim C++ library...")
|
|
25
|
+
System.loadLibrary("videotrim")
|
|
26
|
+
Log.i(TAG, "Successfully loaded videotrim C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load videotrim C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#
|
|
2
|
+
# videotrim+autolinking.cmake
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/videotrim+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Add all headers that were generated by Nitrogen
|
|
17
|
+
include_directories(
|
|
18
|
+
"../nitrogen/generated/shared/c++"
|
|
19
|
+
"../nitrogen/generated/android/c++"
|
|
20
|
+
"../nitrogen/generated/android/"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
24
|
+
target_sources(
|
|
25
|
+
# CMake project name (Android C++ library name)
|
|
26
|
+
videotrim PRIVATE
|
|
27
|
+
# Autolinking Setup
|
|
28
|
+
../nitrogen/generated/android/videotrimOnLoad.cpp
|
|
29
|
+
# Shared Nitrogen C++ sources
|
|
30
|
+
../nitrogen/generated/shared/c++/HybridVideoTrimSpec.cpp
|
|
31
|
+
# Android-specific Nitrogen C++ sources
|
|
32
|
+
../nitrogen/generated/android/c++/JHybridVideoTrimSpec.cpp
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Define a flag to check if we are building properly
|
|
36
|
+
add_definitions(-DBUILDING_VIDEOTRIM_WITH_GENERATED_CMAKE_PROJECT)
|
|
37
|
+
|
|
38
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
39
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
40
|
+
target_compile_definitions(
|
|
41
|
+
videotrim PRIVATE
|
|
42
|
+
-DFOLLY_NO_CONFIG=1
|
|
43
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
44
|
+
-DFOLLY_USE_LIBCPP=1
|
|
45
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
46
|
+
-DFOLLY_MOBILE=1
|
|
47
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
48
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
49
|
+
# Once we target android-23 above, we can comment
|
|
50
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
51
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Add all libraries required by the generated specs
|
|
55
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
56
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
57
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
58
|
+
|
|
59
|
+
# Link all libraries together
|
|
60
|
+
target_link_libraries(
|
|
61
|
+
videotrim
|
|
62
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
63
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
64
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
68
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
69
|
+
target_link_libraries(
|
|
70
|
+
videotrim
|
|
71
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
72
|
+
)
|
|
73
|
+
else()
|
|
74
|
+
target_link_libraries(
|
|
75
|
+
videotrim
|
|
76
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
77
|
+
)
|
|
78
|
+
endif()
|