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,237 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JEditorConfig.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 "EditorConfig.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 "EditorConfig" and the the Kotlin data class "EditorConfig".
|
|
21
|
+
*/
|
|
22
|
+
struct JEditorConfig final: public jni::JavaClass<JEditorConfig> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videotrim/EditorConfig;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct EditorConfig by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
EditorConfig toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldEnableHapticFeedback = clazz->getField<jboolean>("enableHapticFeedback");
|
|
35
|
+
jboolean enableHapticFeedback = this->getFieldValue(fieldEnableHapticFeedback);
|
|
36
|
+
static const auto fieldMaxDuration = clazz->getField<double>("maxDuration");
|
|
37
|
+
double maxDuration = this->getFieldValue(fieldMaxDuration);
|
|
38
|
+
static const auto fieldMinDuration = clazz->getField<double>("minDuration");
|
|
39
|
+
double minDuration = this->getFieldValue(fieldMinDuration);
|
|
40
|
+
static const auto fieldCancelButtonText = clazz->getField<jni::JString>("cancelButtonText");
|
|
41
|
+
jni::local_ref<jni::JString> cancelButtonText = this->getFieldValue(fieldCancelButtonText);
|
|
42
|
+
static const auto fieldSaveButtonText = clazz->getField<jni::JString>("saveButtonText");
|
|
43
|
+
jni::local_ref<jni::JString> saveButtonText = this->getFieldValue(fieldSaveButtonText);
|
|
44
|
+
static const auto fieldEnableCancelDialog = clazz->getField<jboolean>("enableCancelDialog");
|
|
45
|
+
jboolean enableCancelDialog = this->getFieldValue(fieldEnableCancelDialog);
|
|
46
|
+
static const auto fieldCancelDialogTitle = clazz->getField<jni::JString>("cancelDialogTitle");
|
|
47
|
+
jni::local_ref<jni::JString> cancelDialogTitle = this->getFieldValue(fieldCancelDialogTitle);
|
|
48
|
+
static const auto fieldCancelDialogMessage = clazz->getField<jni::JString>("cancelDialogMessage");
|
|
49
|
+
jni::local_ref<jni::JString> cancelDialogMessage = this->getFieldValue(fieldCancelDialogMessage);
|
|
50
|
+
static const auto fieldCancelDialogCancelText = clazz->getField<jni::JString>("cancelDialogCancelText");
|
|
51
|
+
jni::local_ref<jni::JString> cancelDialogCancelText = this->getFieldValue(fieldCancelDialogCancelText);
|
|
52
|
+
static const auto fieldCancelDialogConfirmText = clazz->getField<jni::JString>("cancelDialogConfirmText");
|
|
53
|
+
jni::local_ref<jni::JString> cancelDialogConfirmText = this->getFieldValue(fieldCancelDialogConfirmText);
|
|
54
|
+
static const auto fieldEnableSaveDialog = clazz->getField<jboolean>("enableSaveDialog");
|
|
55
|
+
jboolean enableSaveDialog = this->getFieldValue(fieldEnableSaveDialog);
|
|
56
|
+
static const auto fieldSaveDialogTitle = clazz->getField<jni::JString>("saveDialogTitle");
|
|
57
|
+
jni::local_ref<jni::JString> saveDialogTitle = this->getFieldValue(fieldSaveDialogTitle);
|
|
58
|
+
static const auto fieldSaveDialogMessage = clazz->getField<jni::JString>("saveDialogMessage");
|
|
59
|
+
jni::local_ref<jni::JString> saveDialogMessage = this->getFieldValue(fieldSaveDialogMessage);
|
|
60
|
+
static const auto fieldSaveDialogCancelText = clazz->getField<jni::JString>("saveDialogCancelText");
|
|
61
|
+
jni::local_ref<jni::JString> saveDialogCancelText = this->getFieldValue(fieldSaveDialogCancelText);
|
|
62
|
+
static const auto fieldSaveDialogConfirmText = clazz->getField<jni::JString>("saveDialogConfirmText");
|
|
63
|
+
jni::local_ref<jni::JString> saveDialogConfirmText = this->getFieldValue(fieldSaveDialogConfirmText);
|
|
64
|
+
static const auto fieldTrimmingText = clazz->getField<jni::JString>("trimmingText");
|
|
65
|
+
jni::local_ref<jni::JString> trimmingText = this->getFieldValue(fieldTrimmingText);
|
|
66
|
+
static const auto fieldFullScreenModalIOS = clazz->getField<jboolean>("fullScreenModalIOS");
|
|
67
|
+
jboolean fullScreenModalIOS = this->getFieldValue(fieldFullScreenModalIOS);
|
|
68
|
+
static const auto fieldAutoplay = clazz->getField<jboolean>("autoplay");
|
|
69
|
+
jboolean autoplay = this->getFieldValue(fieldAutoplay);
|
|
70
|
+
static const auto fieldJumpToPositionOnLoad = clazz->getField<double>("jumpToPositionOnLoad");
|
|
71
|
+
double jumpToPositionOnLoad = this->getFieldValue(fieldJumpToPositionOnLoad);
|
|
72
|
+
static const auto fieldCloseWhenFinish = clazz->getField<jboolean>("closeWhenFinish");
|
|
73
|
+
jboolean closeWhenFinish = this->getFieldValue(fieldCloseWhenFinish);
|
|
74
|
+
static const auto fieldEnableCancelTrimming = clazz->getField<jboolean>("enableCancelTrimming");
|
|
75
|
+
jboolean enableCancelTrimming = this->getFieldValue(fieldEnableCancelTrimming);
|
|
76
|
+
static const auto fieldCancelTrimmingButtonText = clazz->getField<jni::JString>("cancelTrimmingButtonText");
|
|
77
|
+
jni::local_ref<jni::JString> cancelTrimmingButtonText = this->getFieldValue(fieldCancelTrimmingButtonText);
|
|
78
|
+
static const auto fieldEnableCancelTrimmingDialog = clazz->getField<jboolean>("enableCancelTrimmingDialog");
|
|
79
|
+
jboolean enableCancelTrimmingDialog = this->getFieldValue(fieldEnableCancelTrimmingDialog);
|
|
80
|
+
static const auto fieldCancelTrimmingDialogTitle = clazz->getField<jni::JString>("cancelTrimmingDialogTitle");
|
|
81
|
+
jni::local_ref<jni::JString> cancelTrimmingDialogTitle = this->getFieldValue(fieldCancelTrimmingDialogTitle);
|
|
82
|
+
static const auto fieldCancelTrimmingDialogMessage = clazz->getField<jni::JString>("cancelTrimmingDialogMessage");
|
|
83
|
+
jni::local_ref<jni::JString> cancelTrimmingDialogMessage = this->getFieldValue(fieldCancelTrimmingDialogMessage);
|
|
84
|
+
static const auto fieldCancelTrimmingDialogCancelText = clazz->getField<jni::JString>("cancelTrimmingDialogCancelText");
|
|
85
|
+
jni::local_ref<jni::JString> cancelTrimmingDialogCancelText = this->getFieldValue(fieldCancelTrimmingDialogCancelText);
|
|
86
|
+
static const auto fieldCancelTrimmingDialogConfirmText = clazz->getField<jni::JString>("cancelTrimmingDialogConfirmText");
|
|
87
|
+
jni::local_ref<jni::JString> cancelTrimmingDialogConfirmText = this->getFieldValue(fieldCancelTrimmingDialogConfirmText);
|
|
88
|
+
static const auto fieldHeaderText = clazz->getField<jni::JString>("headerText");
|
|
89
|
+
jni::local_ref<jni::JString> headerText = this->getFieldValue(fieldHeaderText);
|
|
90
|
+
static const auto fieldHeaderTextSize = clazz->getField<double>("headerTextSize");
|
|
91
|
+
double headerTextSize = this->getFieldValue(fieldHeaderTextSize);
|
|
92
|
+
static const auto fieldHeaderTextColor = clazz->getField<double>("headerTextColor");
|
|
93
|
+
double headerTextColor = this->getFieldValue(fieldHeaderTextColor);
|
|
94
|
+
static const auto fieldAlertOnFailToLoad = clazz->getField<jboolean>("alertOnFailToLoad");
|
|
95
|
+
jboolean alertOnFailToLoad = this->getFieldValue(fieldAlertOnFailToLoad);
|
|
96
|
+
static const auto fieldAlertOnFailTitle = clazz->getField<jni::JString>("alertOnFailTitle");
|
|
97
|
+
jni::local_ref<jni::JString> alertOnFailTitle = this->getFieldValue(fieldAlertOnFailTitle);
|
|
98
|
+
static const auto fieldAlertOnFailMessage = clazz->getField<jni::JString>("alertOnFailMessage");
|
|
99
|
+
jni::local_ref<jni::JString> alertOnFailMessage = this->getFieldValue(fieldAlertOnFailMessage);
|
|
100
|
+
static const auto fieldAlertOnFailCloseText = clazz->getField<jni::JString>("alertOnFailCloseText");
|
|
101
|
+
jni::local_ref<jni::JString> alertOnFailCloseText = this->getFieldValue(fieldAlertOnFailCloseText);
|
|
102
|
+
static const auto fieldSaveToPhoto = clazz->getField<jboolean>("saveToPhoto");
|
|
103
|
+
jboolean saveToPhoto = this->getFieldValue(fieldSaveToPhoto);
|
|
104
|
+
static const auto fieldType = clazz->getField<jni::JString>("type");
|
|
105
|
+
jni::local_ref<jni::JString> type = this->getFieldValue(fieldType);
|
|
106
|
+
static const auto fieldOutputExt = clazz->getField<jni::JString>("outputExt");
|
|
107
|
+
jni::local_ref<jni::JString> outputExt = this->getFieldValue(fieldOutputExt);
|
|
108
|
+
static const auto fieldOpenDocumentsOnFinish = clazz->getField<jboolean>("openDocumentsOnFinish");
|
|
109
|
+
jboolean openDocumentsOnFinish = this->getFieldValue(fieldOpenDocumentsOnFinish);
|
|
110
|
+
static const auto fieldOpenShareSheetOnFinish = clazz->getField<jboolean>("openShareSheetOnFinish");
|
|
111
|
+
jboolean openShareSheetOnFinish = this->getFieldValue(fieldOpenShareSheetOnFinish);
|
|
112
|
+
static const auto fieldRemoveAfterSavedToPhoto = clazz->getField<jboolean>("removeAfterSavedToPhoto");
|
|
113
|
+
jboolean removeAfterSavedToPhoto = this->getFieldValue(fieldRemoveAfterSavedToPhoto);
|
|
114
|
+
static const auto fieldRemoveAfterFailedToSavePhoto = clazz->getField<jboolean>("removeAfterFailedToSavePhoto");
|
|
115
|
+
jboolean removeAfterFailedToSavePhoto = this->getFieldValue(fieldRemoveAfterFailedToSavePhoto);
|
|
116
|
+
static const auto fieldRemoveAfterSavedToDocuments = clazz->getField<jboolean>("removeAfterSavedToDocuments");
|
|
117
|
+
jboolean removeAfterSavedToDocuments = this->getFieldValue(fieldRemoveAfterSavedToDocuments);
|
|
118
|
+
static const auto fieldRemoveAfterFailedToSaveDocuments = clazz->getField<jboolean>("removeAfterFailedToSaveDocuments");
|
|
119
|
+
jboolean removeAfterFailedToSaveDocuments = this->getFieldValue(fieldRemoveAfterFailedToSaveDocuments);
|
|
120
|
+
static const auto fieldRemoveAfterShared = clazz->getField<jboolean>("removeAfterShared");
|
|
121
|
+
jboolean removeAfterShared = this->getFieldValue(fieldRemoveAfterShared);
|
|
122
|
+
static const auto fieldRemoveAfterFailedToShare = clazz->getField<jboolean>("removeAfterFailedToShare");
|
|
123
|
+
jboolean removeAfterFailedToShare = this->getFieldValue(fieldRemoveAfterFailedToShare);
|
|
124
|
+
static const auto fieldEnableRotation = clazz->getField<jboolean>("enableRotation");
|
|
125
|
+
jboolean enableRotation = this->getFieldValue(fieldEnableRotation);
|
|
126
|
+
static const auto fieldRotationAngle = clazz->getField<double>("rotationAngle");
|
|
127
|
+
double rotationAngle = this->getFieldValue(fieldRotationAngle);
|
|
128
|
+
return EditorConfig(
|
|
129
|
+
static_cast<bool>(enableHapticFeedback),
|
|
130
|
+
maxDuration,
|
|
131
|
+
minDuration,
|
|
132
|
+
cancelButtonText->toStdString(),
|
|
133
|
+
saveButtonText->toStdString(),
|
|
134
|
+
static_cast<bool>(enableCancelDialog),
|
|
135
|
+
cancelDialogTitle->toStdString(),
|
|
136
|
+
cancelDialogMessage->toStdString(),
|
|
137
|
+
cancelDialogCancelText->toStdString(),
|
|
138
|
+
cancelDialogConfirmText->toStdString(),
|
|
139
|
+
static_cast<bool>(enableSaveDialog),
|
|
140
|
+
saveDialogTitle->toStdString(),
|
|
141
|
+
saveDialogMessage->toStdString(),
|
|
142
|
+
saveDialogCancelText->toStdString(),
|
|
143
|
+
saveDialogConfirmText->toStdString(),
|
|
144
|
+
trimmingText->toStdString(),
|
|
145
|
+
static_cast<bool>(fullScreenModalIOS),
|
|
146
|
+
static_cast<bool>(autoplay),
|
|
147
|
+
jumpToPositionOnLoad,
|
|
148
|
+
static_cast<bool>(closeWhenFinish),
|
|
149
|
+
static_cast<bool>(enableCancelTrimming),
|
|
150
|
+
cancelTrimmingButtonText->toStdString(),
|
|
151
|
+
static_cast<bool>(enableCancelTrimmingDialog),
|
|
152
|
+
cancelTrimmingDialogTitle->toStdString(),
|
|
153
|
+
cancelTrimmingDialogMessage->toStdString(),
|
|
154
|
+
cancelTrimmingDialogCancelText->toStdString(),
|
|
155
|
+
cancelTrimmingDialogConfirmText->toStdString(),
|
|
156
|
+
headerText->toStdString(),
|
|
157
|
+
headerTextSize,
|
|
158
|
+
headerTextColor,
|
|
159
|
+
static_cast<bool>(alertOnFailToLoad),
|
|
160
|
+
alertOnFailTitle->toStdString(),
|
|
161
|
+
alertOnFailMessage->toStdString(),
|
|
162
|
+
alertOnFailCloseText->toStdString(),
|
|
163
|
+
static_cast<bool>(saveToPhoto),
|
|
164
|
+
type->toStdString(),
|
|
165
|
+
outputExt->toStdString(),
|
|
166
|
+
static_cast<bool>(openDocumentsOnFinish),
|
|
167
|
+
static_cast<bool>(openShareSheetOnFinish),
|
|
168
|
+
static_cast<bool>(removeAfterSavedToPhoto),
|
|
169
|
+
static_cast<bool>(removeAfterFailedToSavePhoto),
|
|
170
|
+
static_cast<bool>(removeAfterSavedToDocuments),
|
|
171
|
+
static_cast<bool>(removeAfterFailedToSaveDocuments),
|
|
172
|
+
static_cast<bool>(removeAfterShared),
|
|
173
|
+
static_cast<bool>(removeAfterFailedToShare),
|
|
174
|
+
static_cast<bool>(enableRotation),
|
|
175
|
+
rotationAngle
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
public:
|
|
180
|
+
/**
|
|
181
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
182
|
+
*/
|
|
183
|
+
[[maybe_unused]]
|
|
184
|
+
static jni::local_ref<JEditorConfig::javaobject> fromCpp(const EditorConfig& value) {
|
|
185
|
+
return newInstance(
|
|
186
|
+
value.enableHapticFeedback,
|
|
187
|
+
value.maxDuration,
|
|
188
|
+
value.minDuration,
|
|
189
|
+
jni::make_jstring(value.cancelButtonText),
|
|
190
|
+
jni::make_jstring(value.saveButtonText),
|
|
191
|
+
value.enableCancelDialog,
|
|
192
|
+
jni::make_jstring(value.cancelDialogTitle),
|
|
193
|
+
jni::make_jstring(value.cancelDialogMessage),
|
|
194
|
+
jni::make_jstring(value.cancelDialogCancelText),
|
|
195
|
+
jni::make_jstring(value.cancelDialogConfirmText),
|
|
196
|
+
value.enableSaveDialog,
|
|
197
|
+
jni::make_jstring(value.saveDialogTitle),
|
|
198
|
+
jni::make_jstring(value.saveDialogMessage),
|
|
199
|
+
jni::make_jstring(value.saveDialogCancelText),
|
|
200
|
+
jni::make_jstring(value.saveDialogConfirmText),
|
|
201
|
+
jni::make_jstring(value.trimmingText),
|
|
202
|
+
value.fullScreenModalIOS,
|
|
203
|
+
value.autoplay,
|
|
204
|
+
value.jumpToPositionOnLoad,
|
|
205
|
+
value.closeWhenFinish,
|
|
206
|
+
value.enableCancelTrimming,
|
|
207
|
+
jni::make_jstring(value.cancelTrimmingButtonText),
|
|
208
|
+
value.enableCancelTrimmingDialog,
|
|
209
|
+
jni::make_jstring(value.cancelTrimmingDialogTitle),
|
|
210
|
+
jni::make_jstring(value.cancelTrimmingDialogMessage),
|
|
211
|
+
jni::make_jstring(value.cancelTrimmingDialogCancelText),
|
|
212
|
+
jni::make_jstring(value.cancelTrimmingDialogConfirmText),
|
|
213
|
+
jni::make_jstring(value.headerText),
|
|
214
|
+
value.headerTextSize,
|
|
215
|
+
value.headerTextColor,
|
|
216
|
+
value.alertOnFailToLoad,
|
|
217
|
+
jni::make_jstring(value.alertOnFailTitle),
|
|
218
|
+
jni::make_jstring(value.alertOnFailMessage),
|
|
219
|
+
jni::make_jstring(value.alertOnFailCloseText),
|
|
220
|
+
value.saveToPhoto,
|
|
221
|
+
jni::make_jstring(value.type),
|
|
222
|
+
jni::make_jstring(value.outputExt),
|
|
223
|
+
value.openDocumentsOnFinish,
|
|
224
|
+
value.openShareSheetOnFinish,
|
|
225
|
+
value.removeAfterSavedToPhoto,
|
|
226
|
+
value.removeAfterFailedToSavePhoto,
|
|
227
|
+
value.removeAfterSavedToDocuments,
|
|
228
|
+
value.removeAfterFailedToSaveDocuments,
|
|
229
|
+
value.removeAfterShared,
|
|
230
|
+
value.removeAfterFailedToShare,
|
|
231
|
+
value.enableRotation,
|
|
232
|
+
value.rotationAngle
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
} // namespace margelo::nitro::videotrim
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFileValidationResult.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 "FileValidationResult.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 "FileValidationResult" and the the Kotlin data class "FileValidationResult".
|
|
21
|
+
*/
|
|
22
|
+
struct JFileValidationResult final: public jni::JavaClass<JFileValidationResult> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videotrim/FileValidationResult;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct FileValidationResult by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
FileValidationResult toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldIsValid = clazz->getField<jboolean>("isValid");
|
|
35
|
+
jboolean isValid = this->getFieldValue(fieldIsValid);
|
|
36
|
+
static const auto fieldFileType = clazz->getField<jni::JString>("fileType");
|
|
37
|
+
jni::local_ref<jni::JString> fileType = this->getFieldValue(fieldFileType);
|
|
38
|
+
static const auto fieldDuration = clazz->getField<double>("duration");
|
|
39
|
+
double duration = this->getFieldValue(fieldDuration);
|
|
40
|
+
return FileValidationResult(
|
|
41
|
+
static_cast<bool>(isValid),
|
|
42
|
+
fileType->toStdString(),
|
|
43
|
+
duration
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
50
|
+
*/
|
|
51
|
+
[[maybe_unused]]
|
|
52
|
+
static jni::local_ref<JFileValidationResult::javaobject> fromCpp(const FileValidationResult& value) {
|
|
53
|
+
return newInstance(
|
|
54
|
+
value.isValid,
|
|
55
|
+
jni::make_jstring(value.fileType),
|
|
56
|
+
value.duration
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::videotrim
|
|
@@ -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,151 @@
|
|
|
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
|
+
// Forward declaration of `TrimOptions` to properly resolve imports.
|
|
15
|
+
namespace margelo::nitro::videotrim { struct TrimOptions; }
|
|
16
|
+
|
|
17
|
+
#include <NitroModules/Promise.hpp>
|
|
18
|
+
#include <vector>
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <NitroModules/JPromise.hpp>
|
|
21
|
+
#include "FileValidationResult.hpp"
|
|
22
|
+
#include "JFileValidationResult.hpp"
|
|
23
|
+
#include "EditorConfig.hpp"
|
|
24
|
+
#include "JEditorConfig.hpp"
|
|
25
|
+
#include <functional>
|
|
26
|
+
#include <unordered_map>
|
|
27
|
+
#include "JFunc_void_std__string_std__unordered_map_std__string__std__string_.hpp"
|
|
28
|
+
#include "JFunc_void.hpp"
|
|
29
|
+
#include "TrimOptions.hpp"
|
|
30
|
+
#include "JTrimOptions.hpp"
|
|
31
|
+
|
|
32
|
+
namespace margelo::nitro::videotrim {
|
|
33
|
+
|
|
34
|
+
jni::local_ref<JHybridVideoTrimSpec::jhybriddata> JHybridVideoTrimSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
35
|
+
return makeCxxInstance(jThis);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void JHybridVideoTrimSpec::registerNatives() {
|
|
39
|
+
registerHybrid({
|
|
40
|
+
makeNativeMethod("initHybrid", JHybridVideoTrimSpec::initHybrid),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
size_t JHybridVideoTrimSpec::getExternalMemorySize() noexcept {
|
|
45
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
46
|
+
return method(_javaPart);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Properties
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// Methods
|
|
53
|
+
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) {
|
|
54
|
+
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");
|
|
55
|
+
method(_javaPart, jni::make_jstring(filePath), JEditorConfig::fromCpp(config), JFunc_void_std__string_std__unordered_map_std__string__std__string__cxx::fromCpp(onEvent));
|
|
56
|
+
}
|
|
57
|
+
std::shared_ptr<Promise<std::vector<std::string>>> JHybridVideoTrimSpec::listFiles() {
|
|
58
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("listFiles");
|
|
59
|
+
auto __result = method(_javaPart);
|
|
60
|
+
return [&]() {
|
|
61
|
+
auto __promise = Promise<std::vector<std::string>>::create();
|
|
62
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
63
|
+
auto __result = jni::static_ref_cast<jni::JArrayClass<jni::JString>>(__boxedResult);
|
|
64
|
+
__promise->resolve([&]() {
|
|
65
|
+
size_t __size = __result->size();
|
|
66
|
+
std::vector<std::string> __vector;
|
|
67
|
+
__vector.reserve(__size);
|
|
68
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
69
|
+
auto __element = __result->getElement(__i);
|
|
70
|
+
__vector.push_back(__element->toStdString());
|
|
71
|
+
}
|
|
72
|
+
return __vector;
|
|
73
|
+
}());
|
|
74
|
+
});
|
|
75
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
76
|
+
jni::JniException __jniError(__throwable);
|
|
77
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
78
|
+
});
|
|
79
|
+
return __promise;
|
|
80
|
+
}();
|
|
81
|
+
}
|
|
82
|
+
std::shared_ptr<Promise<double>> JHybridVideoTrimSpec::cleanFiles() {
|
|
83
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("cleanFiles");
|
|
84
|
+
auto __result = method(_javaPart);
|
|
85
|
+
return [&]() {
|
|
86
|
+
auto __promise = Promise<double>::create();
|
|
87
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
88
|
+
auto __result = jni::static_ref_cast<jni::JDouble>(__boxedResult);
|
|
89
|
+
__promise->resolve(__result->value());
|
|
90
|
+
});
|
|
91
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
92
|
+
jni::JniException __jniError(__throwable);
|
|
93
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
94
|
+
});
|
|
95
|
+
return __promise;
|
|
96
|
+
}();
|
|
97
|
+
}
|
|
98
|
+
std::shared_ptr<Promise<bool>> JHybridVideoTrimSpec::deleteFile(const std::string& filePath) {
|
|
99
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* filePath */)>("deleteFile");
|
|
100
|
+
auto __result = method(_javaPart, jni::make_jstring(filePath));
|
|
101
|
+
return [&]() {
|
|
102
|
+
auto __promise = Promise<bool>::create();
|
|
103
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
104
|
+
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
105
|
+
__promise->resolve(static_cast<bool>(__result->value()));
|
|
106
|
+
});
|
|
107
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
108
|
+
jni::JniException __jniError(__throwable);
|
|
109
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
110
|
+
});
|
|
111
|
+
return __promise;
|
|
112
|
+
}();
|
|
113
|
+
}
|
|
114
|
+
void JHybridVideoTrimSpec::closeEditor(const std::function<void()>& onComplete) {
|
|
115
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* onComplete */)>("closeEditor_cxx");
|
|
116
|
+
method(_javaPart, JFunc_void_cxx::fromCpp(onComplete));
|
|
117
|
+
}
|
|
118
|
+
std::shared_ptr<Promise<FileValidationResult>> JHybridVideoTrimSpec::isValidFile(const std::string& url) {
|
|
119
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* url */)>("isValidFile");
|
|
120
|
+
auto __result = method(_javaPart, jni::make_jstring(url));
|
|
121
|
+
return [&]() {
|
|
122
|
+
auto __promise = Promise<FileValidationResult>::create();
|
|
123
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
124
|
+
auto __result = jni::static_ref_cast<JFileValidationResult>(__boxedResult);
|
|
125
|
+
__promise->resolve(__result->toCpp());
|
|
126
|
+
});
|
|
127
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
128
|
+
jni::JniException __jniError(__throwable);
|
|
129
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
130
|
+
});
|
|
131
|
+
return __promise;
|
|
132
|
+
}();
|
|
133
|
+
}
|
|
134
|
+
std::shared_ptr<Promise<std::string>> JHybridVideoTrimSpec::trim(const std::string& url, const TrimOptions& options) {
|
|
135
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* url */, jni::alias_ref<JTrimOptions> /* options */)>("trim");
|
|
136
|
+
auto __result = method(_javaPart, jni::make_jstring(url), JTrimOptions::fromCpp(options));
|
|
137
|
+
return [&]() {
|
|
138
|
+
auto __promise = Promise<std::string>::create();
|
|
139
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
140
|
+
auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
|
|
141
|
+
__promise->resolve(__result->toStdString());
|
|
142
|
+
});
|
|
143
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
144
|
+
jni::JniException __jniError(__throwable);
|
|
145
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
146
|
+
});
|
|
147
|
+
return __promise;
|
|
148
|
+
}();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
} // namespace margelo::nitro::videotrim
|