Skip to content

Commit

Permalink
Add version 2.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leontobias committed Apr 18, 2023
1 parent 4753e30 commit fc3852f
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 26 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [2.17.0]

### Added

* Added `configuration.singleToolMode` that skips main menu if only one tool is used.
* [react-native-videoeditorsdk] Added `RNVideoEditorSDKModule.editorWillOpenClosure` and `RNVideoEditorSDKModule.editorWillExportClosure` which allow further native configuration on Android.
* [react-native-photoeditorsdk] Added `RNPhotoEditorSDKModule.editorWillOpenClosure` and `RNPhotoEditorSDKModule.editorWillExportClosure` which allow further native configuration on Android.

### Fixed

* [react-native-videoeditorsdk] Fixed `VideoEditorResult.videoSize` would always be zero.
* [react-native-videoeditorsdk] Fixed error when not setting `Configuration.export.video.segments`.

## [2.16.1]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In order to run any samples or use any wrapper without a watermark,
you'll have to purchase a commercial PhotoEditor SDK or VideoEditor SDK
license. Visit https://img.ly for more details.

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

Redistribution and use in source and binary forms, with or without
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ In order to use this module with the Expo CLI you can make use of our integrated
"react-native-imglysdk",
{
"android": {
"version": "10.4.0",
"version": "10.4.1",
"modules": [
"ui:core",
"ui:transform",
Expand Down Expand Up @@ -161,12 +161,12 @@ For older React Native versions autolinking is not available and VideoEditor SDK
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.32"
classpath 'ly.img.android.sdk:plugin:10.4.0'
classpath 'ly.img.android.sdk:plugin:10.4.1'
}
}
```

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).
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).

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

Expand Down
2 changes: 1 addition & 1 deletion RNVideoEditorSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Pod::Spec.new do |s|

s.dependency 'React'
s.dependency 'React-RCTImage'
s.dependency 'VideoEditorSDK', '~> 11.3'
s.dependency 'VideoEditorSDK', '~> 11.4'
end
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ imglyConfig {
}
}

def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.4.0"
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.4.1"

task checkVersion {
if (imglyConfig.convertToVersionNumber(imglyConfig.getVersion()) < imglyConfig.convertToVersionNumber(MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION)) {
Expand Down
1 change: 1 addition & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:exported="false"
android:enabled="false"
android:name="ly.img.android.IMGLYAutoInit" />
<activity android:name=".RNVideoEditorSDKActivity" />
</application>
</manifest>

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.util.Log
import androidx.annotation.WorkerThread
import com.facebook.react.bridge.*
import ly.img.android.IMGLY
import ly.img.android.VESDK
import ly.img.android.pesdk.VideoEditorSettingsList
import ly.img.android.pesdk.backend.decoder.VideoSource
import ly.img.android.pesdk.backend.model.state.LoadSettings
import ly.img.android.pesdk.backend.model.state.manager.SettingsList
import ly.img.android.pesdk.kotlin_extension.continueWithExceptions
Expand All @@ -23,16 +25,23 @@ import java.io.File
import ly.img.android.pesdk.backend.encoder.Encoder
import ly.img.android.pesdk.backend.model.EditorSDKResult
import ly.img.android.pesdk.backend.model.VideoPart
import ly.img.android.pesdk.backend.model.state.LoadState
import ly.img.android.pesdk.backend.model.state.VideoCompositionSettings
import ly.img.android.pesdk.backend.model.state.manager.StateHandler
import ly.img.android.pesdk.ui.activity.VideoEditorActivity
import ly.img.android.serializer._3.IMGLYFileReader
import ly.img.android.serializer._3.IMGLYFileWriter
import java.util.UUID

class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), ActivityEventListener {
companion object {
// This number must be unique. It is public to allow client code to change it if the same value is used elsewhere.
var EDITOR_RESULT_ID = 29065
@JvmField var EDITOR_RESULT_ID = 29065

/** A closure to modify a *VideoEditorSettingsList* before the editor is opened. */
@JvmField var editorWillOpenClosure: ((settingsList: VideoEditorSettingsList) -> Unit)? = null

/** A closure allowing access to the *StateHandler* before the editor is exporting. */
@JvmField var editorWillExportClosure: ((stateHandler: StateHandler) -> Unit)? = null
}

init {
Expand Down Expand Up @@ -62,9 +71,9 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte

override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, intent: Intent?) {
val data = try {
intent?.let { EditorSDKResult(it) }
intent?.let { EditorSDKResult(it) }
} catch (e: EditorSDKResult.NotAnImglyResultException) {
null
null
} ?: return // If data is null the result is not from us.

when (requestCode) {
Expand Down Expand Up @@ -128,10 +137,10 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
}

var segments: ReadableArray? = null
val canvasSize = settingsList[LoadState::class].sourceSize
val canvasSize = sourcePath?.let { VideoSource.create(it).fetchFormatInfo()?.size }
val serializedSize = reactMap(
"height" to canvasSize.height,
"width" to canvasSize.width
"height" to canvasSize?.height,
"width" to canvasSize?.width
)

if (resolveManually) {
Expand Down Expand Up @@ -166,8 +175,9 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
@ReactMethod
fun present(video: String, config: ReadableMap?, serialization: String?, promise: Promise) {
val configuration = ConfigLoader.readFrom(config?.toHashMap() ?: mapOf())
val exportVideoSegments = config?.getMap("export")?.getMap("video")?.getBoolean("segments") == true
val createTemporaryFiles = configuration.export?.serialization?.enabled == true || exportVideoSegments
val serializationEnabled = configuration.export?.serialization?.enabled == true
val exportVideoSegments = configuration.export?.video?.segments == true
val createTemporaryFiles = serializationEnabled || exportVideoSegments
resolveManually = exportVideoSegments

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

val configuration = ConfigLoader.readFrom(config?.toHashMap() ?: mapOf())

val exportVideoSegments = config?.getMap("export")?.getMap("video")?.getBoolean("segments") == true
val createTemporaryFiles = configuration.export?.serialization?.enabled == true || exportVideoSegments
val serializationEnabled = configuration.export?.serialization?.enabled == true
val exportVideoSegments = configuration.export?.video?.segments == true
val createTemporaryFiles = serializationEnabled || exportVideoSegments
resolveManually = exportVideoSegments

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

private fun readSerialisation(settingsList: SettingsList, serialization: String?, readImage: Boolean) {
private fun readSerialisation(settingsList: VideoEditorSettingsList, serialization: String?, readImage: Boolean) {
editorWillOpenClosure?.invoke(settingsList)

if (serialization != null) {
skipIfNotExists {
IMGLYFileReader(settingsList).also {
Expand All @@ -308,12 +320,13 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte

private fun startEditor(settingsList: VideoEditorSettingsList?) {
val currentActivity = this.currentActivity ?: throw RuntimeException("Can't start the Editor because there is no current activity")
currentEditorUID = UUID.randomUUID().toString()
if (settingsList != null) {
currentEditorUID = UUID.randomUUID().toString()

MainThreadRunnable {
VideoEditorBuilder(currentActivity)
.setSettingsList(settingsList)
.startActivityForResult(currentActivity, EDITOR_RESULT_ID)
VideoEditorBuilder(currentActivity, RNVideoEditorSDKActivity::class.java)
.setSettingsList(settingsList)
.startActivityForResult(currentActivity, EDITOR_RESULT_ID)
settingsList.release()
}()
}
Expand Down Expand Up @@ -417,4 +430,14 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
}

override fun getName() = "RNVideoEditorSDK"
}
}

/** A *VideoEditorActivity* used for the native interfaces. */
class RNVideoEditorSDKActivity: VideoEditorActivity() {
@WorkerThread
override fun onExportStart(stateHandler: StateHandler) {
RNVideoEditorSDKModule.editorWillExportClosure?.invoke(stateHandler)

super.onExportStart(stateHandler)
}
}
9 changes: 9 additions & 0 deletions configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export interface Configuration {
*/
forceCrop?: boolean;

/**
* Controls if the editor is used in single tool mode.
* Prerequisite is that only one tool is in `tools`.
*
* @example // Defaults to:
* true
*/
singleToolMode?: boolean;

/**
* Defines all allowed actions for the main screen that are displayed as overlay buttons on the canvas.
* Only buttons for allowed actions are visible.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-videoeditorsdk",
"title": "React Native module for VideoEditor SDK",
"version": "2.16.1",
"version": "2.17.0",
"description": "A React Native module for VideoEditor SDK. Integrate the video editor into your own HTML5, iOS or Android app - in minutes!",
"main": "index.js",
"typings": "index.d.ts",
Expand Down Expand Up @@ -35,6 +35,6 @@
"react-native": ">=0.60.0 <1.0.x"
},
"dependencies": {
"react-native-imglysdk": "2.16.1"
"react-native-imglysdk": "2.17.0"
}
}

0 comments on commit fc3852f

Please sign in to comment.