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
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Mai Trung Duc
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# Table of contents
|
|
2
|
+
- [Installation](#installation)
|
|
3
|
+
* [For iOS (React Native CLI project)](#for-ios-react-native-cli-project)
|
|
4
|
+
* [For Expo project](#for-expo-project)
|
|
5
|
+
* [Usage](#usage)
|
|
6
|
+
- [Methods](#methods)
|
|
7
|
+
* [showEditor(videoPath: string, config?: EditorConfig, onEvent?: (eventName: string, payload: Record<string, string>) => void)](#showeditorvideopath-string-config-editorconfig-onevent-eventname-string-payload-record--void)
|
|
8
|
+
* [isValidFile(videoPath: string)](#isvalidfilevideopath-string)
|
|
9
|
+
* [closeEditor()](#closeeditor)
|
|
10
|
+
* [listFiles()](#listfiles)
|
|
11
|
+
* [cleanFiles()](#cleanfiles)
|
|
12
|
+
* [deleteFile()](#deletefile)
|
|
13
|
+
- [Callbacks (New arch)](#callbacks-new-arch)
|
|
14
|
+
* [showEditor](#showeditor)
|
|
15
|
+
* [closeEditor](#closeeditor-1)
|
|
16
|
+
- [Events (Old arch)](#events-old-arch)
|
|
17
|
+
- [Audio support](#audio-support)
|
|
18
|
+
- [Cancel trimming](#cancel-trimming)
|
|
19
|
+
- [Fail to load media](#fail-to-load-media)
|
|
20
|
+
- [Android: update SDK version](#android-update-sdk-version)
|
|
21
|
+
- [Thanks](#thanks)
|
|
22
|
+
|
|
1
23
|
# React Native Video Trim
|
|
2
24
|
<div align="center">
|
|
3
25
|
<h2>Video trimmer for your React Native app</h2>
|
|
@@ -8,7 +30,7 @@
|
|
|
8
30
|
|
|
9
31
|
## Features
|
|
10
32
|
- ✅ Support video and audio
|
|
11
|
-
- ✅ Support local files
|
|
33
|
+
- ✅ Support local files and remote files (remote files need `https` version, see below)
|
|
12
34
|
- ✅ Save to Photos, Documents and Share to other apps
|
|
13
35
|
- ✅ Check if file is valid video/audio
|
|
14
36
|
- ✅ File operations: list, clean up, delete specific file
|
|
@@ -19,7 +41,7 @@
|
|
|
19
41
|
<img src="images/share_sheet.png" width="300" />
|
|
20
42
|
</div>
|
|
21
43
|
|
|
22
|
-
|
|
44
|
+
# Installation
|
|
23
45
|
|
|
24
46
|
```sh
|
|
25
47
|
# new arch
|
|
@@ -36,6 +58,9 @@ yarn add react-native-video-trim react-native-nitro-modules
|
|
|
36
58
|
# old arch
|
|
37
59
|
yarn add react-native-video-trim@^3.0.0
|
|
38
60
|
```
|
|
61
|
+
|
|
62
|
+
> `react-native-nitro-modules` is required in New Arch as this library relies on [Nitro Modules](https://nitro.margelo.com/).
|
|
63
|
+
|
|
39
64
|
## For iOS (React Native CLI project)
|
|
40
65
|
Run the following command to setup for iOS:
|
|
41
66
|
```
|
|
@@ -45,9 +70,10 @@ npx pod-install ios
|
|
|
45
70
|
You need to run `prebuild` in order for native code takes effect:
|
|
46
71
|
```
|
|
47
72
|
npx expo prebuild
|
|
48
|
-
|
|
49
|
-
npx pod-install ios
|
|
50
73
|
```
|
|
74
|
+
Then you need to restart to make the changes take effect
|
|
75
|
+
|
|
76
|
+
> Note that on iOS you'll need to run on real device, Expo Go may not work because of library linking
|
|
51
77
|
|
|
52
78
|
## Usage
|
|
53
79
|
|
|
@@ -79,62 +105,8 @@ import {
|
|
|
79
105
|
} from 'react-native';
|
|
80
106
|
import { isValidFile, showEditor } from 'react-native-video-trim';
|
|
81
107
|
import { launchImageLibrary } from 'react-native-image-picker';
|
|
82
|
-
import { useEffect } from 'react';
|
|
83
108
|
|
|
84
109
|
export default function App() {
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
const eventEmitter = new NativeEventEmitter(NativeModules.VideoTrim);
|
|
87
|
-
const subscription = eventEmitter.addListener('VideoTrim', (event) => {
|
|
88
|
-
switch (event.name) {
|
|
89
|
-
case 'onLoad': {
|
|
90
|
-
// on media loaded successfully
|
|
91
|
-
console.log('onLoadListener', event);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case 'onShow': {
|
|
95
|
-
console.log('onShowListener', event);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
case 'onHide': {
|
|
99
|
-
console.log('onHide', event);
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
case 'onStartTrimming': {
|
|
103
|
-
console.log('onStartTrimming', event);
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case 'onFinishTrimming': {
|
|
107
|
-
console.log('onFinishTrimming', event);
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
case 'onCancelTrimming': {
|
|
111
|
-
console.log('onCancelTrimming', event);
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
case 'onCancel': {
|
|
115
|
-
console.log('onCancel', event);
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
case 'onError': {
|
|
119
|
-
console.log('onError', event);
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
case 'onLog': {
|
|
123
|
-
console.log('onLog', event);
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
case 'onStatistics': {
|
|
127
|
-
console.log('onStatistics', event);
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
return () => {
|
|
134
|
-
subscription.remove();
|
|
135
|
-
};
|
|
136
|
-
}, []);
|
|
137
|
-
|
|
138
110
|
return (
|
|
139
111
|
<View style={styles.container}>
|
|
140
112
|
<TouchableOpacity
|
|
@@ -150,7 +122,11 @@ export default function App() {
|
|
|
150
122
|
|
|
151
123
|
showEditor(result.assets![0]?.uri || '', {
|
|
152
124
|
maxDuration: 20,
|
|
153
|
-
}
|
|
125
|
+
},
|
|
126
|
+
(eventName, payload) => {
|
|
127
|
+
console.log('Event:', eventName, 'Payload:', payload);
|
|
128
|
+
}
|
|
129
|
+
);
|
|
154
130
|
}}
|
|
155
131
|
style={{ padding: 10, backgroundColor: 'red' }}
|
|
156
132
|
>
|
|
@@ -183,7 +159,7 @@ const styles = StyleSheet.create({
|
|
|
183
159
|
|
|
184
160
|
# Methods
|
|
185
161
|
|
|
186
|
-
## showEditor(videoPath: string, config?: EditorConfig)
|
|
162
|
+
## showEditor(videoPath: string, config?: EditorConfig, onEvent?: (eventName: string, payload: Record<string, string>) => void)
|
|
187
163
|
Main method to show Video Editor UI.
|
|
188
164
|
|
|
189
165
|
*Params*:
|
|
@@ -235,6 +211,8 @@ Main method to show Video Editor UI.
|
|
|
235
211
|
- `alertOnFailTitle` (`default = "Error"`)
|
|
236
212
|
- `alertOnFailMessage` (`default = "Fail to load media. Possibly invalid file or no network connection"`)
|
|
237
213
|
- `alertOnFailCloseText` (`default = "Close"`)
|
|
214
|
+
- `enableRotation` (`default = false`)
|
|
215
|
+
- `rotationAngle` (`default = 0`)
|
|
238
216
|
|
|
239
217
|
If `saveToPhoto = true`, you must ensure that you have request permission to write to photo/gallery
|
|
240
218
|
- For Android: you need to have `<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />` in AndroidManifest.xml
|
|
@@ -265,6 +243,10 @@ If you face issue when building Android app related to `file_paths`, then you ma
|
|
|
265
243
|
</paths>
|
|
266
244
|
```
|
|
267
245
|
|
|
246
|
+
# trim(url: string, options: TrimOptions): Promise<string>
|
|
247
|
+
|
|
248
|
+
Directly trim a file without showing editor
|
|
249
|
+
|
|
268
250
|
## isValidFile(videoPath: string)
|
|
269
251
|
|
|
270
252
|
This method is to check if a path is a valid video/audio
|
|
@@ -286,8 +268,21 @@ Delete a file in app storage. Return `true` if success
|
|
|
286
268
|
|
|
287
269
|
## showEditor
|
|
288
270
|
|
|
271
|
+
```ts
|
|
272
|
+
showEditor('file', config, (eventName, payload) => {
|
|
273
|
+
console.log(eventName, payload)
|
|
274
|
+
})
|
|
275
|
+
```
|
|
276
|
+
|
|
289
277
|
## closeEditor
|
|
290
278
|
|
|
279
|
+
```ts
|
|
280
|
+
closeEditor(() => {
|
|
281
|
+
console.log('Editor closed')
|
|
282
|
+
})
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
|
|
291
286
|
# Events (Old arch)
|
|
292
287
|
To listen for events you interest, do the following:
|
|
293
288
|
```js
|
|
@@ -374,14 +369,36 @@ If there's error while loading media, there'll be a prompt
|
|
|
374
369
|
|
|
375
370
|
Related props: `alertOnFailToLoad, alertOnFailTitle, alertOnFailMessage, alertOnFailCloseText`
|
|
376
371
|
|
|
372
|
+
# Use FFMPEG HTTPS version
|
|
373
|
+
|
|
374
|
+
If you want to trim a remote file, you need to use `https` version (default is `min` which does not support remote file).
|
|
375
|
+
|
|
376
|
+
Do the following:
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
// android/build.gradle
|
|
380
|
+
buildscript {
|
|
381
|
+
ext {
|
|
382
|
+
VideoTrim_ffmpeg_package=https
|
|
383
|
+
|
|
384
|
+
// optional: VideoTrim_ffmpeg_version=6.0.1
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// ios
|
|
389
|
+
FFMPEGKIT_PACKAGE=https FFMPEG_KIT_PACKAGE_VERSION=6.0 pod install
|
|
390
|
+
```
|
|
391
|
+
|
|
377
392
|
# Android: update SDK version
|
|
378
393
|
You can override sdk version to use any version in your `android/build.gradle` > `buildscript` > `ext`
|
|
379
394
|
```gradle
|
|
380
395
|
buildscript {
|
|
381
396
|
ext {
|
|
382
|
-
|
|
383
|
-
VideoTrim_minSdkVersion
|
|
384
|
-
VideoTrim_targetSdkVersion
|
|
397
|
+
VideoTrim_kotlinVersion=2.0.21
|
|
398
|
+
VideoTrim_minSdkVersion=24
|
|
399
|
+
VideoTrim_targetSdkVersion=34
|
|
400
|
+
VideoTrim_compileSdkVersion=35
|
|
401
|
+
VideoTrim_ndkVersion=27.1.12297006
|
|
385
402
|
}
|
|
386
403
|
}
|
|
387
404
|
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "VideoTrim"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/maitrungduc1410/react-native-video-trim.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
+
|
|
18
|
+
s.dependency "ffmpeg-mobile-#{ENV['FFMPEGKIT_PACKAGE'] || 'min'}", ENV['FFMPEGKIT_PACKAGE_VERSION'] || '~> 6.0'
|
|
19
|
+
|
|
20
|
+
load 'nitrogen/generated/ios/VideoTrim+autolinking.rb'
|
|
21
|
+
add_nitrogen_files(s)
|
|
22
|
+
|
|
23
|
+
install_modules_dependencies(s)
|
|
24
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
project(videotrim)
|
|
2
|
+
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
+
|
|
4
|
+
set(PACKAGE_NAME videotrim)
|
|
5
|
+
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
# Define C++ library and add all sources
|
|
9
|
+
add_library(${PACKAGE_NAME} SHARED src/main/cpp/cpp-adapter.cpp)
|
|
10
|
+
|
|
11
|
+
# Add Nitrogen specs :)
|
|
12
|
+
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/videotrim+autolinking.cmake)
|
|
13
|
+
|
|
14
|
+
# Set up local includes
|
|
15
|
+
include_directories("src/main/cpp" "../cpp")
|
|
16
|
+
|
|
17
|
+
find_library(LOG_LIB log)
|
|
18
|
+
|
|
19
|
+
# Link all libraries together
|
|
20
|
+
target_link_libraries(
|
|
21
|
+
${PACKAGE_NAME}
|
|
22
|
+
${LOG_LIB}
|
|
23
|
+
android # <-- Android core
|
|
24
|
+
)
|
package/android/build.gradle
CHANGED
|
@@ -1,70 +1,102 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['VideoTrim_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
2
6
|
repositories {
|
|
3
7
|
google()
|
|
4
8
|
mavenCentral()
|
|
5
9
|
}
|
|
6
10
|
|
|
7
11
|
dependencies {
|
|
8
|
-
classpath "com.android.tools.build:gradle:7.2
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
9
15
|
}
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
def
|
|
13
|
-
|
|
18
|
+
def reactNativeArchitectures() {
|
|
19
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
20
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
apply plugin: "com.android.library"
|
|
24
|
+
apply plugin: "kotlin-android"
|
|
25
|
+
apply from: '../nitrogen/generated/android/videotrim+autolinking.gradle'
|
|
17
26
|
|
|
18
|
-
|
|
19
|
-
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
20
|
-
|
|
21
|
-
if (isNewArchitectureEnabled()) {
|
|
22
|
-
apply plugin: "com.facebook.react"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
def getExtOrDefault(name) {
|
|
26
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["VideoTrim_" + name]
|
|
27
|
-
}
|
|
27
|
+
apply plugin: "com.facebook.react"
|
|
28
28
|
|
|
29
29
|
def getExtOrIntegerDefault(name) {
|
|
30
30
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["VideoTrim_" + name]).toInteger()
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
def
|
|
34
|
-
|
|
35
|
-
def major = parsed[0].toInteger()
|
|
36
|
-
def minor = parsed[1].toInteger()
|
|
37
|
-
|
|
38
|
-
// Namespace support was added in 7.3.0
|
|
39
|
-
if (major == 7 && minor >= 3) {
|
|
40
|
-
return true
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return major >= 8
|
|
33
|
+
def getPackageNameOrDefault() {
|
|
34
|
+
return rootProject.ext.has("VideoTrim_ffmpeg_package") ? rootProject.ext.get("VideoTrim_ffmpeg_package") : project.properties["VideoTrim_ffmpeg_package"]
|
|
44
35
|
}
|
|
45
36
|
|
|
46
|
-
def
|
|
47
|
-
rootProject.ext.has(
|
|
37
|
+
def getPackageVersionOrDefault() {
|
|
38
|
+
return rootProject.ext.has("VideoTrim_ffmpeg_version") ? rootProject.ext.get("VideoTrim_ffmpeg_version") : project.properties["VideoTrim_ffmpeg_version"]
|
|
48
39
|
}
|
|
49
40
|
|
|
50
41
|
android {
|
|
51
|
-
|
|
52
|
-
namespace "com.videotrim"
|
|
53
|
-
} else {
|
|
54
|
-
sourceSets {
|
|
55
|
-
main {
|
|
56
|
-
manifest.srcFile "src/main/AndroidManifestDeprecated.xml"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
42
|
+
namespace "com.margelo.nitro.videotrim"
|
|
60
43
|
|
|
61
44
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
62
45
|
|
|
63
46
|
defaultConfig {
|
|
64
47
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
48
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
|
-
|
|
49
|
+
|
|
50
|
+
externalNativeBuild {
|
|
51
|
+
cmake {
|
|
52
|
+
cppFlags "-frtti -fexceptions -Wall -fstack-protector-all"
|
|
53
|
+
arguments "-DANDROID_STL=c++_shared"
|
|
54
|
+
abiFilters (*reactNativeArchitectures())
|
|
55
|
+
|
|
56
|
+
buildTypes {
|
|
57
|
+
debug {
|
|
58
|
+
cppFlags "-O1 -g"
|
|
59
|
+
}
|
|
60
|
+
release {
|
|
61
|
+
cppFlags "-O2"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
externalNativeBuild {
|
|
69
|
+
cmake {
|
|
70
|
+
path "CMakeLists.txt"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
packagingOptions {
|
|
75
|
+
excludes = [
|
|
76
|
+
"META-INF",
|
|
77
|
+
"META-INF/**",
|
|
78
|
+
"**/libc++_shared.so",
|
|
79
|
+
"**/libfbjni.so",
|
|
80
|
+
"**/libjsi.so",
|
|
81
|
+
"**/libfolly_json.so",
|
|
82
|
+
"**/libfolly_runtime.so",
|
|
83
|
+
"**/libglog.so",
|
|
84
|
+
"**/libhermes.so",
|
|
85
|
+
"**/libhermes-executor-debug.so",
|
|
86
|
+
"**/libhermes_executor.so",
|
|
87
|
+
"**/libreactnative.so",
|
|
88
|
+
"**/libreactnativejni.so",
|
|
89
|
+
"**/libturbomodulejsijni.so",
|
|
90
|
+
"**/libreact_nativemodule_core.so",
|
|
91
|
+
"**/libjscexecutor.so"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
buildFeatures {
|
|
96
|
+
buildConfig true
|
|
97
|
+
prefab true
|
|
67
98
|
}
|
|
99
|
+
|
|
68
100
|
buildTypes {
|
|
69
101
|
release {
|
|
70
102
|
minifyEnabled false
|
|
@@ -80,6 +112,14 @@ android {
|
|
|
80
112
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
81
113
|
}
|
|
82
114
|
|
|
115
|
+
sourceSets {
|
|
116
|
+
main {
|
|
117
|
+
java.srcDirs += [
|
|
118
|
+
"generated/java",
|
|
119
|
+
"generated/jni"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
83
123
|
}
|
|
84
124
|
|
|
85
125
|
repositories {
|
|
@@ -87,20 +127,13 @@ repositories {
|
|
|
87
127
|
google()
|
|
88
128
|
}
|
|
89
129
|
|
|
130
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
90
131
|
|
|
91
132
|
dependencies {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
implementation "com.facebook.react:react-native:+"
|
|
96
|
-
implementation 'androidx.recyclerview:recyclerview:1.3.1'
|
|
97
|
-
implementation 'io.github.maitrungduc1410:ffmpeg-kit-min:6.0.0'
|
|
98
|
-
}
|
|
133
|
+
implementation "com.facebook.react:react-android"
|
|
134
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
135
|
+
implementation project(":react-native-nitro-modules")
|
|
99
136
|
|
|
100
|
-
|
|
101
|
-
react {
|
|
102
|
-
jsRootDir = file("../src/")
|
|
103
|
-
libraryName = "VideoTrim"
|
|
104
|
-
codegenJavaPackageName = "com.videotrim"
|
|
105
|
-
}
|
|
137
|
+
implementation 'io.github.maitrungduc1410:ffmpeg-kit-' + getPackageNameOrDefault() +':' + getPackageVersionOrDefault()
|
|
106
138
|
}
|
|
139
|
+
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
VideoTrim_kotlinVersion=
|
|
2
|
-
VideoTrim_minSdkVersion=
|
|
3
|
-
VideoTrim_targetSdkVersion=
|
|
4
|
-
VideoTrim_compileSdkVersion=
|
|
5
|
-
|
|
1
|
+
VideoTrim_kotlinVersion=2.0.21
|
|
2
|
+
VideoTrim_minSdkVersion=24
|
|
3
|
+
VideoTrim_targetSdkVersion=34
|
|
4
|
+
VideoTrim_compileSdkVersion=35
|
|
5
|
+
VideoTrim_ndkVersion=27.1.12297006
|
|
6
|
+
VideoTrim_ffmpeg_package=min
|
|
7
|
+
VideoTrim_ffmpeg_version=6.0.1
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
<manifest
|
|
1
|
+
<manifest
|
|
2
|
+
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
package="com.margelo.nitro.videotrim">
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<uses-permission android:name="android.permission.VIBRATE" />
|
|
4
6
|
|
|
5
7
|
<application>
|
|
6
8
|
<!-- FileProvider setup -->
|