react-native-video-trim 3.0.9 → 4.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 (88) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +64 -61
  3. package/VideoTrim.podspec +24 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +77 -51
  6. package/android/gradle.properties +5 -5
  7. package/android/src/main/AndroidManifest.xml +4 -2
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/videotrim/VideoTrim.kt +629 -0
  10. package/android/src/main/java/com/margelo/nitro/videotrim/VideoTrimPackage.kt +22 -0
  11. package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/enums/ErrorCode.java +1 -1
  12. package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/interfaces/IVideoTrimmerView.java +1 -1
  13. package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/interfaces/VideoTrimListener.java +6 -4
  14. package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/utils/MediaMetadataUtil.java +1 -1
  15. package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/utils/StorageUtil.java +3 -1
  16. package/android/src/main/java/com/margelo/nitro/videotrim/utils/VideoTrimmerUtil.java +157 -0
  17. package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/widgets/VideoTrimmerView.java +44 -72
  18. package/ios/AssetLoader.swift +2 -2
  19. package/ios/ErrorCode.swift +2 -2
  20. package/ios/ProgressAlertController.swift +2 -2
  21. package/ios/VideoTrim.swift +38 -739
  22. package/ios/VideoTrimImpl.swift +860 -0
  23. package/ios/VideoTrimmer.swift +2 -3
  24. package/ios/VideoTrimmerThumb.swift +33 -26
  25. package/ios/VideoTrimmerViewController.swift +47 -28
  26. package/lib/module/VideoTrim.nitro.js +4 -0
  27. package/lib/module/VideoTrim.nitro.js.map +1 -0
  28. package/lib/module/index.js +71 -22
  29. package/lib/module/index.js.map +1 -1
  30. package/lib/module/package.json +1 -0
  31. package/lib/typescript/package.json +1 -0
  32. package/lib/typescript/{index.d.ts → src/VideoTrim.nitro.d.ts} +63 -89
  33. package/lib/typescript/src/VideoTrim.nitro.d.ts.map +1 -0
  34. package/lib/typescript/src/index.d.ts +41 -0
  35. package/lib/typescript/src/index.d.ts.map +1 -0
  36. package/nitrogen/generated/android/c++/JEditorConfig.hpp +229 -0
  37. package/nitrogen/generated/android/c++/JFileValidationResult.hpp +61 -0
  38. package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
  39. package/nitrogen/generated/android/c++/JFunc_void_std__string_std__unordered_map_std__string__std__string_.hpp +89 -0
  40. package/nitrogen/generated/android/c++/JHybridVideoTrimSpec.cpp +131 -0
  41. package/nitrogen/generated/android/c++/JHybridVideoTrimSpec.hpp +67 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/EditorConfig.kt +70 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/FileValidationResult.kt +28 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/Func_void.kt +80 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/Func_void_std__string_std__unordered_map_std__string__std__string_.kt +80 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/HybridVideoTrimSpec.kt +82 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/videotrimOnLoad.kt +35 -0
  48. package/nitrogen/generated/android/videotrim+autolinking.cmake +78 -0
  49. package/nitrogen/generated/android/videotrim+autolinking.gradle +27 -0
  50. package/nitrogen/generated/android/videotrimOnLoad.cpp +50 -0
  51. package/nitrogen/generated/android/videotrimOnLoad.hpp +25 -0
  52. package/nitrogen/generated/ios/VideoTrim+autolinking.rb +60 -0
  53. package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Bridge.cpp +88 -0
  54. package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Bridge.hpp +331 -0
  55. package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Umbrella.hpp +53 -0
  56. package/nitrogen/generated/ios/VideoTrimAutolinking.mm +33 -0
  57. package/nitrogen/generated/ios/VideoTrimAutolinking.swift +25 -0
  58. package/nitrogen/generated/ios/c++/HybridVideoTrimSpecSwift.cpp +11 -0
  59. package/nitrogen/generated/ios/c++/HybridVideoTrimSpecSwift.hpp +116 -0
  60. package/nitrogen/generated/ios/swift/EditorConfig.swift +519 -0
  61. package/nitrogen/generated/ios/swift/FileValidationResult.swift +57 -0
  62. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  63. package/nitrogen/generated/ios/swift/Func_void_FileValidationResult.swift +46 -0
  64. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  65. package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
  66. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  67. package/nitrogen/generated/ios/swift/Func_void_std__string_std__unordered_map_std__string__std__string_.swift +54 -0
  68. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
  69. package/nitrogen/generated/ios/swift/HybridVideoTrimSpec.swift +53 -0
  70. package/nitrogen/generated/ios/swift/HybridVideoTrimSpec_cxx.swift +222 -0
  71. package/nitrogen/generated/shared/c++/EditorConfig.hpp +245 -0
  72. package/nitrogen/generated/shared/c++/FileValidationResult.hpp +77 -0
  73. package/nitrogen/generated/shared/c++/HybridVideoTrimSpec.cpp +26 -0
  74. package/nitrogen/generated/shared/c++/HybridVideoTrimSpec.hpp +76 -0
  75. package/package.json +75 -71
  76. package/src/VideoTrim.nitro.ts +244 -0
  77. package/src/index.tsx +87 -258
  78. package/android/src/main/AndroidManifestDeprecated.xml +0 -3
  79. package/android/src/main/java/com/videotrim/VideoTrimModule.java +0 -600
  80. package/android/src/main/java/com/videotrim/VideoTrimPackage.java +0 -28
  81. package/android/src/main/java/com/videotrim/utils/VideoTrimmerUtil.java +0 -270
  82. package/ios/VideoTrim-Bridging-Header.h +0 -2
  83. package/ios/VideoTrim.mm +0 -17
  84. package/ios/VideoTrim.xcodeproj/project.pbxproj +0 -283
  85. package/lib/commonjs/index.js +0 -87
  86. package/lib/commonjs/index.js.map +0 -1
  87. package/lib/typescript/index.d.ts.map +0 -1
  88. package/react-native-video-trim.podspec +0 -41
@@ -0,0 +1,74 @@
1
+ ///
2
+ /// JFunc_void.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 <functional>
12
+
13
+ #include <functional>
14
+
15
+ namespace margelo::nitro::videotrim {
16
+
17
+ using namespace facebook;
18
+
19
+ /**
20
+ * Represents the Java/Kotlin callback `() -> Unit`.
21
+ * This can be passed around between C++ and Java/Kotlin.
22
+ */
23
+ struct JFunc_void: public jni::JavaClass<JFunc_void> {
24
+ public:
25
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videotrim/Func_void;";
26
+
27
+ public:
28
+ /**
29
+ * Invokes the function this `JFunc_void` instance holds through JNI.
30
+ */
31
+ void invoke() const {
32
+ static const auto method = javaClassStatic()->getMethod<void()>("invoke");
33
+ method(self());
34
+ }
35
+ };
36
+
37
+ /**
38
+ * An implementation of Func_void that is backed by a C++ implementation (using `std::function<...>`)
39
+ */
40
+ struct JFunc_void_cxx final: public jni::HybridClass<JFunc_void_cxx, JFunc_void> {
41
+ public:
42
+ static jni::local_ref<JFunc_void::javaobject> fromCpp(const std::function<void()>& func) {
43
+ return JFunc_void_cxx::newObjectCxxArgs(func);
44
+ }
45
+
46
+ public:
47
+ /**
48
+ * Invokes the C++ `std::function<...>` this `JFunc_void_cxx` instance holds.
49
+ */
50
+ void invoke_cxx() {
51
+ _func();
52
+ }
53
+
54
+ public:
55
+ [[nodiscard]]
56
+ inline const std::function<void()>& getFunction() const {
57
+ return _func;
58
+ }
59
+
60
+ public:
61
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videotrim/Func_void_cxx;";
62
+ static void registerNatives() {
63
+ registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_cxx::invoke_cxx)});
64
+ }
65
+
66
+ private:
67
+ explicit JFunc_void_cxx(const std::function<void()>& func): _func(func) { }
68
+
69
+ private:
70
+ friend HybridBase;
71
+ std::function<void()> _func;
72
+ };
73
+
74
+ } // namespace margelo::nitro::videotrim
@@ -0,0 +1,89 @@
1
+ ///
2
+ /// JFunc_void_std__string_std__unordered_map_std__string__std__string_.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 <functional>
12
+
13
+ #include <functional>
14
+ #include <string>
15
+ #include <unordered_map>
16
+
17
+ namespace margelo::nitro::videotrim {
18
+
19
+ using namespace facebook;
20
+
21
+ /**
22
+ * Represents the Java/Kotlin callback `(eventName: String, payload: Map<String, String>) -> Unit`.
23
+ * This can be passed around between C++ and Java/Kotlin.
24
+ */
25
+ struct JFunc_void_std__string_std__unordered_map_std__string__std__string_: public jni::JavaClass<JFunc_void_std__string_std__unordered_map_std__string__std__string_> {
26
+ public:
27
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videotrim/Func_void_std__string_std__unordered_map_std__string__std__string_;";
28
+
29
+ public:
30
+ /**
31
+ * Invokes the function this `JFunc_void_std__string_std__unordered_map_std__string__std__string_` instance holds through JNI.
32
+ */
33
+ void invoke(const std::string& eventName, const std::unordered_map<std::string, std::string>& payload) const {
34
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* eventName */, jni::alias_ref<jni::JMap<jni::JString, jni::JString>> /* payload */)>("invoke");
35
+ method(self(), jni::make_jstring(eventName), [&]() -> jni::local_ref<jni::JMap<jni::JString, jni::JString>> {
36
+ auto __map = jni::JHashMap<jni::JString, jni::JString>::create(payload.size());
37
+ for (const auto& __entry : payload) {
38
+ __map->put(jni::make_jstring(__entry.first), jni::make_jstring(__entry.second));
39
+ }
40
+ return __map;
41
+ }());
42
+ }
43
+ };
44
+
45
+ /**
46
+ * An implementation of Func_void_std__string_std__unordered_map_std__string__std__string_ that is backed by a C++ implementation (using `std::function<...>`)
47
+ */
48
+ struct JFunc_void_std__string_std__unordered_map_std__string__std__string__cxx final: public jni::HybridClass<JFunc_void_std__string_std__unordered_map_std__string__std__string__cxx, JFunc_void_std__string_std__unordered_map_std__string__std__string_> {
49
+ public:
50
+ static jni::local_ref<JFunc_void_std__string_std__unordered_map_std__string__std__string_::javaobject> fromCpp(const std::function<void(const std::string& /* eventName */, const std::unordered_map<std::string, std::string>& /* payload */)>& func) {
51
+ return JFunc_void_std__string_std__unordered_map_std__string__std__string__cxx::newObjectCxxArgs(func);
52
+ }
53
+
54
+ public:
55
+ /**
56
+ * Invokes the C++ `std::function<...>` this `JFunc_void_std__string_std__unordered_map_std__string__std__string__cxx` instance holds.
57
+ */
58
+ void invoke_cxx(jni::alias_ref<jni::JString> eventName, jni::alias_ref<jni::JMap<jni::JString, jni::JString>> payload) {
59
+ _func(eventName->toStdString(), [&]() {
60
+ std::unordered_map<std::string, std::string> __map;
61
+ __map.reserve(payload->size());
62
+ for (const auto& __entry : *payload) {
63
+ __map.emplace(__entry.first->toStdString(), __entry.second->toStdString());
64
+ }
65
+ return __map;
66
+ }());
67
+ }
68
+
69
+ public:
70
+ [[nodiscard]]
71
+ inline const std::function<void(const std::string& /* eventName */, const std::unordered_map<std::string, std::string>& /* payload */)>& getFunction() const {
72
+ return _func;
73
+ }
74
+
75
+ public:
76
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videotrim/Func_void_std__string_std__unordered_map_std__string__std__string__cxx;";
77
+ static void registerNatives() {
78
+ registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_std__unordered_map_std__string__std__string__cxx::invoke_cxx)});
79
+ }
80
+
81
+ private:
82
+ explicit JFunc_void_std__string_std__unordered_map_std__string__std__string__cxx(const std::function<void(const std::string& /* eventName */, const std::unordered_map<std::string, std::string>& /* payload */)>& func): _func(func) { }
83
+
84
+ private:
85
+ friend HybridBase;
86
+ std::function<void(const std::string& /* eventName */, const std::unordered_map<std::string, std::string>& /* payload */)> _func;
87
+ };
88
+
89
+ } // namespace margelo::nitro::videotrim
@@ -0,0 +1,131 @@
1
+ ///
2
+ /// JHybridVideoTrimSpec.cpp
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
+ #include "JHybridVideoTrimSpec.hpp"
9
+
10
+ // Forward declaration of `FileValidationResult` to properly resolve imports.
11
+ namespace margelo::nitro::videotrim { struct FileValidationResult; }
12
+ // Forward declaration of `EditorConfig` to properly resolve imports.
13
+ namespace margelo::nitro::videotrim { struct EditorConfig; }
14
+
15
+ #include <NitroModules/Promise.hpp>
16
+ #include <vector>
17
+ #include <string>
18
+ #include <NitroModules/JPromise.hpp>
19
+ #include "FileValidationResult.hpp"
20
+ #include "JFileValidationResult.hpp"
21
+ #include "EditorConfig.hpp"
22
+ #include "JEditorConfig.hpp"
23
+ #include <functional>
24
+ #include <unordered_map>
25
+ #include "JFunc_void_std__string_std__unordered_map_std__string__std__string_.hpp"
26
+ #include "JFunc_void.hpp"
27
+
28
+ namespace margelo::nitro::videotrim {
29
+
30
+ jni::local_ref<JHybridVideoTrimSpec::jhybriddata> JHybridVideoTrimSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
31
+ return makeCxxInstance(jThis);
32
+ }
33
+
34
+ void JHybridVideoTrimSpec::registerNatives() {
35
+ registerHybrid({
36
+ makeNativeMethod("initHybrid", JHybridVideoTrimSpec::initHybrid),
37
+ });
38
+ }
39
+
40
+ size_t JHybridVideoTrimSpec::getExternalMemorySize() noexcept {
41
+ static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
42
+ return method(_javaPart);
43
+ }
44
+
45
+ // Properties
46
+
47
+
48
+ // Methods
49
+ void JHybridVideoTrimSpec::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) {
50
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* filePath */, jni::alias_ref<JEditorConfig> /* config */, jni::alias_ref<JFunc_void_std__string_std__unordered_map_std__string__std__string_::javaobject> /* onEvent */)>("showEditor_cxx");
51
+ method(_javaPart, jni::make_jstring(filePath), JEditorConfig::fromCpp(config), JFunc_void_std__string_std__unordered_map_std__string__std__string__cxx::fromCpp(onEvent));
52
+ }
53
+ std::shared_ptr<Promise<std::vector<std::string>>> JHybridVideoTrimSpec::listFiles() {
54
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("listFiles");
55
+ auto __result = method(_javaPart);
56
+ return [&]() {
57
+ auto __promise = Promise<std::vector<std::string>>::create();
58
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
59
+ auto __result = jni::static_ref_cast<jni::JArrayClass<jni::JString>>(__boxedResult);
60
+ __promise->resolve([&]() {
61
+ size_t __size = __result->size();
62
+ std::vector<std::string> __vector;
63
+ __vector.reserve(__size);
64
+ for (size_t __i = 0; __i < __size; __i++) {
65
+ auto __element = __result->getElement(__i);
66
+ __vector.push_back(__element->toStdString());
67
+ }
68
+ return __vector;
69
+ }());
70
+ });
71
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
72
+ jni::JniException __jniError(__throwable);
73
+ __promise->reject(std::make_exception_ptr(__jniError));
74
+ });
75
+ return __promise;
76
+ }();
77
+ }
78
+ std::shared_ptr<Promise<double>> JHybridVideoTrimSpec::cleanFiles() {
79
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("cleanFiles");
80
+ auto __result = method(_javaPart);
81
+ return [&]() {
82
+ auto __promise = Promise<double>::create();
83
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
84
+ auto __result = jni::static_ref_cast<jni::JDouble>(__boxedResult);
85
+ __promise->resolve(__result->value());
86
+ });
87
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
88
+ jni::JniException __jniError(__throwable);
89
+ __promise->reject(std::make_exception_ptr(__jniError));
90
+ });
91
+ return __promise;
92
+ }();
93
+ }
94
+ std::shared_ptr<Promise<bool>> JHybridVideoTrimSpec::deleteFile(const std::string& filePath) {
95
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* filePath */)>("deleteFile");
96
+ auto __result = method(_javaPart, jni::make_jstring(filePath));
97
+ return [&]() {
98
+ auto __promise = Promise<bool>::create();
99
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
100
+ auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
101
+ __promise->resolve(static_cast<bool>(__result->value()));
102
+ });
103
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
104
+ jni::JniException __jniError(__throwable);
105
+ __promise->reject(std::make_exception_ptr(__jniError));
106
+ });
107
+ return __promise;
108
+ }();
109
+ }
110
+ void JHybridVideoTrimSpec::closeEditor(const std::function<void()>& onComplete) {
111
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* onComplete */)>("closeEditor_cxx");
112
+ method(_javaPart, JFunc_void_cxx::fromCpp(onComplete));
113
+ }
114
+ std::shared_ptr<Promise<FileValidationResult>> JHybridVideoTrimSpec::isValidFile(const std::string& url) {
115
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* url */)>("isValidFile");
116
+ auto __result = method(_javaPart, jni::make_jstring(url));
117
+ return [&]() {
118
+ auto __promise = Promise<FileValidationResult>::create();
119
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
120
+ auto __result = jni::static_ref_cast<JFileValidationResult>(__boxedResult);
121
+ __promise->resolve(__result->toCpp());
122
+ });
123
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
124
+ jni::JniException __jniError(__throwable);
125
+ __promise->reject(std::make_exception_ptr(__jniError));
126
+ });
127
+ return __promise;
128
+ }();
129
+ }
130
+
131
+ } // namespace margelo::nitro::videotrim
@@ -0,0 +1,67 @@
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
+
61
+ private:
62
+ friend HybridBase;
63
+ using HybridBase::HybridBase;
64
+ jni::global_ref<JHybridVideoTrimSpec::javaobject> _javaPart;
65
+ };
66
+
67
+ } // namespace margelo::nitro::videotrim
@@ -0,0 +1,70 @@
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 saveToPhoto: Boolean,
25
+ val maxDuration: Double,
26
+ val minDuration: Double,
27
+ val cancelButtonText: String,
28
+ val saveButtonText: String,
29
+ val enableCancelDialog: Boolean,
30
+ val cancelDialogTitle: String,
31
+ val cancelDialogMessage: String,
32
+ val cancelDialogCancelText: String,
33
+ val cancelDialogConfirmText: String,
34
+ val enableSaveDialog: Boolean,
35
+ val saveDialogTitle: String,
36
+ val saveDialogMessage: String,
37
+ val saveDialogCancelText: String,
38
+ val saveDialogConfirmText: String,
39
+ val trimmingText: String,
40
+ val fullScreenModalIOS: Boolean,
41
+ val type: String,
42
+ val outputExt: String,
43
+ val openDocumentsOnFinish: Boolean,
44
+ val openShareSheetOnFinish: Boolean,
45
+ val removeAfterSavedToPhoto: Boolean,
46
+ val removeAfterFailedToSavePhoto: Boolean,
47
+ val removeAfterSavedToDocuments: Boolean,
48
+ val removeAfterFailedToSaveDocuments: Boolean,
49
+ val removeAfterShared: Boolean,
50
+ val removeAfterFailedToShare: Boolean,
51
+ val autoplay: Boolean,
52
+ val jumpToPositionOnLoad: Double,
53
+ val closeWhenFinish: Boolean,
54
+ val enableCancelTrimming: Boolean,
55
+ val cancelTrimmingButtonText: String,
56
+ val enableCancelTrimmingDialog: Boolean,
57
+ val cancelTrimmingDialogTitle: String,
58
+ val cancelTrimmingDialogMessage: String,
59
+ val cancelTrimmingDialogCancelText: String,
60
+ val cancelTrimmingDialogConfirmText: String,
61
+ val headerText: String,
62
+ val headerTextSize: Double,
63
+ val headerTextColor: Double,
64
+ val alertOnFailToLoad: Boolean,
65
+ val alertOnFailTitle: String,
66
+ val alertOnFailMessage: String,
67
+ val alertOnFailCloseText: String
68
+ ) {
69
+ /* main constructor */
70
+ }
@@ -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
+ }