Skip to content

Commit fc3852f

Browse files
committed
Add version 2.17.0
1 parent 4753e30 commit fc3852f

9 files changed

+72
-26
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## [2.17.0]
2+
3+
### Added
4+
5+
* Added `configuration.singleToolMode` that skips main menu if only one tool is used.
6+
* [react-native-videoeditorsdk] Added `RNVideoEditorSDKModule.editorWillOpenClosure` and `RNVideoEditorSDKModule.editorWillExportClosure` which allow further native configuration on Android.
7+
* [react-native-photoeditorsdk] Added `RNPhotoEditorSDKModule.editorWillOpenClosure` and `RNPhotoEditorSDKModule.editorWillExportClosure` which allow further native configuration on Android.
8+
9+
### Fixed
10+
11+
* [react-native-videoeditorsdk] Fixed `VideoEditorResult.videoSize` would always be zero.
12+
* [react-native-videoeditorsdk] Fixed error when not setting `Configuration.export.video.segments`.
13+
114
## [2.16.1]
215

316
### Fixed

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In order to run any samples or use any wrapper without a watermark,
44
you'll have to purchase a commercial PhotoEditor SDK or VideoEditor SDK
55
license. Visit https://img.ly for more details.
66

7-
Copyright (c) 2014-2022, img.ly GmbH
7+
Copyright (c) 2014-2023, img.ly GmbH
88
All rights reserved.
99

1010
Redistribution and use in source and binary forms, with or without

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ In order to use this module with the Expo CLI you can make use of our integrated
8686
"react-native-imglysdk",
8787
{
8888
"android": {
89-
"version": "10.4.0",
89+
"version": "10.4.1",
9090
"modules": [
9191
"ui:core",
9292
"ui:transform",
@@ -161,12 +161,12 @@ For older React Native versions autolinking is not available and VideoEditor SDK
161161
}
162162
dependencies {
163163
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.32"
164-
classpath 'ly.img.android.sdk:plugin:10.4.0'
164+
classpath 'ly.img.android.sdk:plugin:10.4.1'
165165
}
166166
}
167167
```
168168

169-
In order to update VideoEditor SDK for Android replace the version string `10.4.0` with a [newer release](https://github.com/imgly/vesdk-android-demo/releases).
169+
In order to update VideoEditor SDK for Android replace the version string `10.4.1` with a [newer release](https://github.com/imgly/vesdk-android-demo/releases).
170170

171171
2. Still in the `android/build.gradle` file (**not** `android/app/build.gradle`), add these lines at the bottom:
172172

RNVideoEditorSDK.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ Pod::Spec.new do |s|
1818

1919
s.dependency 'React'
2020
s.dependency 'React-RCTImage'
21-
s.dependency 'VideoEditorSDK', '~> 11.3'
21+
s.dependency 'VideoEditorSDK', '~> 11.4'
2222
end

android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ imglyConfig {
2020
}
2121
}
2222

23-
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.4.0"
23+
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.4.1"
2424

2525
task checkVersion {
2626
if (imglyConfig.convertToVersionNumber(imglyConfig.getVersion()) < imglyConfig.convertToVersionNumber(MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION)) {

android/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
android:exported="false"
99
android:enabled="false"
1010
android:name="ly.img.android.IMGLYAutoInit" />
11+
<activity android:name=".RNVideoEditorSDKActivity" />
1112
</application>
1213
</manifest>
1314

android/src/main/java/ly/img/react_native/vesdk/RNVideoEditorSDKModule.kt

+41-18
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import android.app.Activity
44
import android.content.Intent
55
import android.net.Uri
66
import android.util.Log
7+
import androidx.annotation.WorkerThread
78
import com.facebook.react.bridge.*
89
import ly.img.android.IMGLY
910
import ly.img.android.VESDK
1011
import ly.img.android.pesdk.VideoEditorSettingsList
12+
import ly.img.android.pesdk.backend.decoder.VideoSource
1113
import ly.img.android.pesdk.backend.model.state.LoadSettings
1214
import ly.img.android.pesdk.backend.model.state.manager.SettingsList
1315
import ly.img.android.pesdk.kotlin_extension.continueWithExceptions
@@ -23,16 +25,23 @@ import java.io.File
2325
import ly.img.android.pesdk.backend.encoder.Encoder
2426
import ly.img.android.pesdk.backend.model.EditorSDKResult
2527
import ly.img.android.pesdk.backend.model.VideoPart
26-
import ly.img.android.pesdk.backend.model.state.LoadState
2728
import ly.img.android.pesdk.backend.model.state.VideoCompositionSettings
29+
import ly.img.android.pesdk.backend.model.state.manager.StateHandler
30+
import ly.img.android.pesdk.ui.activity.VideoEditorActivity
2831
import ly.img.android.serializer._3.IMGLYFileReader
2932
import ly.img.android.serializer._3.IMGLYFileWriter
3033
import java.util.UUID
3134

3235
class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), ActivityEventListener {
3336
companion object {
3437
// This number must be unique. It is public to allow client code to change it if the same value is used elsewhere.
35-
var EDITOR_RESULT_ID = 29065
38+
@JvmField var EDITOR_RESULT_ID = 29065
39+
40+
/** A closure to modify a *VideoEditorSettingsList* before the editor is opened. */
41+
@JvmField var editorWillOpenClosure: ((settingsList: VideoEditorSettingsList) -> Unit)? = null
42+
43+
/** A closure allowing access to the *StateHandler* before the editor is exporting. */
44+
@JvmField var editorWillExportClosure: ((stateHandler: StateHandler) -> Unit)? = null
3645
}
3746

3847
init {
@@ -62,9 +71,9 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
6271

6372
override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, intent: Intent?) {
6473
val data = try {
65-
intent?.let { EditorSDKResult(it) }
74+
intent?.let { EditorSDKResult(it) }
6675
} catch (e: EditorSDKResult.NotAnImglyResultException) {
67-
null
76+
null
6877
} ?: return // If data is null the result is not from us.
6978

7079
when (requestCode) {
@@ -128,10 +137,10 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
128137
}
129138

130139
var segments: ReadableArray? = null
131-
val canvasSize = settingsList[LoadState::class].sourceSize
140+
val canvasSize = sourcePath?.let { VideoSource.create(it).fetchFormatInfo()?.size }
132141
val serializedSize = reactMap(
133-
"height" to canvasSize.height,
134-
"width" to canvasSize.width
142+
"height" to canvasSize?.height,
143+
"width" to canvasSize?.width
135144
)
136145

137146
if (resolveManually) {
@@ -166,8 +175,9 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
166175
@ReactMethod
167176
fun present(video: String, config: ReadableMap?, serialization: String?, promise: Promise) {
168177
val configuration = ConfigLoader.readFrom(config?.toHashMap() ?: mapOf())
169-
val exportVideoSegments = config?.getMap("export")?.getMap("video")?.getBoolean("segments") == true
170-
val createTemporaryFiles = configuration.export?.serialization?.enabled == true || exportVideoSegments
178+
val serializationEnabled = configuration.export?.serialization?.enabled == true
179+
val exportVideoSegments = configuration.export?.video?.segments == true
180+
val createTemporaryFiles = serializationEnabled || exportVideoSegments
171181
resolveManually = exportVideoSegments
172182

173183
val settingsList = VideoEditorSettingsList(createTemporaryFiles)
@@ -189,9 +199,9 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
189199
var source = resolveSize(size)
190200

191201
val configuration = ConfigLoader.readFrom(config?.toHashMap() ?: mapOf())
192-
193-
val exportVideoSegments = config?.getMap("export")?.getMap("video")?.getBoolean("segments") == true
194-
val createTemporaryFiles = configuration.export?.serialization?.enabled == true || exportVideoSegments
202+
val serializationEnabled = configuration.export?.serialization?.enabled == true
203+
val exportVideoSegments = configuration.export?.video?.segments == true
204+
val createTemporaryFiles = serializationEnabled || exportVideoSegments
195205
resolveManually = exportVideoSegments
196206

197207
val settingsList = VideoEditorSettingsList(createTemporaryFiles)
@@ -296,7 +306,9 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
296306
return LoadSettings.compositionSource(width.toInt(), height.toInt(), 60)
297307
}
298308

299-
private fun readSerialisation(settingsList: SettingsList, serialization: String?, readImage: Boolean) {
309+
private fun readSerialisation(settingsList: VideoEditorSettingsList, serialization: String?, readImage: Boolean) {
310+
editorWillOpenClosure?.invoke(settingsList)
311+
300312
if (serialization != null) {
301313
skipIfNotExists {
302314
IMGLYFileReader(settingsList).also {
@@ -308,12 +320,13 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
308320

309321
private fun startEditor(settingsList: VideoEditorSettingsList?) {
310322
val currentActivity = this.currentActivity ?: throw RuntimeException("Can't start the Editor because there is no current activity")
311-
currentEditorUID = UUID.randomUUID().toString()
312323
if (settingsList != null) {
324+
currentEditorUID = UUID.randomUUID().toString()
325+
313326
MainThreadRunnable {
314-
VideoEditorBuilder(currentActivity)
315-
.setSettingsList(settingsList)
316-
.startActivityForResult(currentActivity, EDITOR_RESULT_ID)
327+
VideoEditorBuilder(currentActivity, RNVideoEditorSDKActivity::class.java)
328+
.setSettingsList(settingsList)
329+
.startActivityForResult(currentActivity, EDITOR_RESULT_ID)
317330
settingsList.release()
318331
}()
319332
}
@@ -417,4 +430,14 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
417430
}
418431

419432
override fun getName() = "RNVideoEditorSDK"
420-
}
433+
}
434+
435+
/** A *VideoEditorActivity* used for the native interfaces. */
436+
class RNVideoEditorSDKActivity: VideoEditorActivity() {
437+
@WorkerThread
438+
override fun onExportStart(stateHandler: StateHandler) {
439+
RNVideoEditorSDKModule.editorWillExportClosure?.invoke(stateHandler)
440+
441+
super.onExportStart(stateHandler)
442+
}
443+
}

configuration.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export interface Configuration {
2424
*/
2525
forceCrop?: boolean;
2626

27+
/**
28+
* Controls if the editor is used in single tool mode.
29+
* Prerequisite is that only one tool is in `tools`.
30+
*
31+
* @example // Defaults to:
32+
* true
33+
*/
34+
singleToolMode?: boolean;
35+
2736
/**
2837
* Defines all allowed actions for the main screen that are displayed as overlay buttons on the canvas.
2938
* Only buttons for allowed actions are visible.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-videoeditorsdk",
33
"title": "React Native module for VideoEditor SDK",
4-
"version": "2.16.1",
4+
"version": "2.17.0",
55
"description": "A React Native module for VideoEditor SDK. Integrate the video editor into your own HTML5, iOS or Android app - in minutes!",
66
"main": "index.js",
77
"typings": "index.d.ts",
@@ -35,6 +35,6 @@
3535
"react-native": ">=0.60.0 <1.0.x"
3636
},
3737
"dependencies": {
38-
"react-native-imglysdk": "2.16.1"
38+
"react-native-imglysdk": "2.17.0"
3939
}
4040
}

0 commit comments

Comments
 (0)