Skip to content

Commit

Permalink
Add version 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leontobias committed Oct 18, 2022
1 parent c13a3cb commit 4fef6e4
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [3.3.0]

### Added

* Added option to specify the version of the native VideoEditor SDK for Android version via a `imglyConfig.json` file. See the [README](https://github.com/imgly/vesdk-cordova/blob/master/README.md#version) for more information.

## [3.2.0]

### Changed
Expand Down
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</p>

# Cordova & Ionic plugin for VideoEditor SDK

## Getting started

Add VideoEditor SDK plugin to your project as follows:
Expand All @@ -25,6 +26,7 @@ cordova plugin add cordova-plugin-videoeditorsdk
With version `3.2.0`, we recommend using `compileSdkVersion` not lower than `31` for Android. However, this might interfere with your application's Android Gradle Plugin version if this is set to `4.x`.

If you don't use a newer Android Gradle Plugin version, you'll most likely encounter a build error similar to:

```
FAILURE: Build failed with an exception.
Expand All @@ -37,12 +39,28 @@ Run with --stacktrace option to get the stack trace. Run with --info or --debug
* Get more help at https://help.gradle.org
```

As a workaround you can create the following symlinks:
1. Inside `/Users/YOUR-USERNAME/Library/Android/sdk/build-tools/31.0.0/`: Create a `dx` symlink for the `d8` file with `ln -s d8 dx`.
2. From there, go to `./lib/` and create a `dx.jar` symlink for the `d8.jar` file with `ln -s d8.jar dx.jar`.

1. Inside `/Users/YOUR-USERNAME/Library/Android/sdk/build-tools/31.0.0/`: Create a `dx` symlink for the `d8` file with `ln -s d8 dx`.
2. From there, go to `./lib/` and create a `dx.jar` symlink for the `d8.jar` file with `ln -s d8.jar dx.jar`.

### Android

#### Version

You can configure the native Android VideoEditor SDK version used by creating a `imglyConfig.json` file and specifying a specific version:

```json
{
"version": "10.3.3"
}
```

If no version / no configuration file is specified, the module will use the default minimum required version.

#### AndroidX

From version `3.0.0` the plugin uses AndroidX. To enable AndroidX in your application please adjust your `config.xml`:

```diff
Expand Down Expand Up @@ -81,8 +99,7 @@ With version `3.2.0` the plugin requires `minSdkVersion` `21` or higher. Dependi

We further recommend you to update your `buildToolsVersion` to `31.0.0` as well as your `compileSdkVersion` to `31`. However, this is not mandatory. For further reference on how to update these variables, please refer to the official [Cordova documentation](https://cordova.apache.org/docs/en/11.x/guide/platforms/android/index.html#configuring-gradle).


#### Module Configuration
#### Modules

You can configure the modules used for the VideoEditor SDK for Android by opening `imglyConfig.gradle` and removing / commenting out the modules you do not need. This will also reduce the size of your application.

Expand All @@ -97,20 +114,23 @@ cordova plugin add cordova-plugin-enable-multidex
Each platform requires a separate license file. Unlock VideoEditor SDK with a single line of code for both platforms via platform-specific file extensions.

Rename your license files:

- Android license: `ANY_NAME.android`
- iOS license: `ANY_NAME.ios`

Pass the file path without the extension to the `unlockWithLicense` function to unlock both iOS and Android:

```js
VESDK.unlockWithLicense('www/assets/ANY_NAME');
VESDK.unlockWithLicense("www/assets/ANY_NAME");
```

Open the editor with a video:

```js
VESDK.openEditor(
successCallback,
failureCallback,
VESDK.resolveStaticResource('www/assets/video.mp4')
VESDK.resolveStaticResource("www/assets/video.mp4")
);
```

Expand Down
31 changes: 27 additions & 4 deletions hooks/dependencies-gradle-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,30 @@ module.exports = (context) => {
const VERSION_BLOCK_START = "// VERSION CHANGED BY IMGLY - START - ";
const VERSION_BLOCK_END = "// VERSION CHANGED BY IMGLY - END -";
const gradlePluginVersion = '1.5.32';
var sdkVersion = "10.1.1";

try {
const configFilePath = path.join(
context.opts.projectRoot,
"imglyConfig.json"
);
const config = fs.readFileSync(configFilePath, "utf8");
if (config != null) {
const configJson = JSON.parse(config);
const configVersion = configJson.version;
if (configVersion != null) sdkVersion = configVersion;
}
} catch {
console.log(
"Warning: There is no imglyConfig.json file in your root directory. Consider adding it to customize the IMG.LY Android SDK integration."
);
}

const imglyDependencies =
"\n" +
BLOCK_START +
`
classpath "ly.img.android.sdk:plugin:10.1.1"` +
classpath "ly.img.android.sdk:plugin:${sdkVersion}"` +
"\n" +
BLOCK_END +
"\n";
Expand Down Expand Up @@ -57,10 +75,15 @@ module.exports = (context) => {

const regex = /ext.kotlin_version = '([0-9]*).([0-9]*).([0-9]*)'/gm;
const versionMatch = regex.exec(fileContents);

if (versionMatch != null) {
const version = versionMatch[0].replace("ext.kotlin_version = ", "");
const newVersion = `${VERSION_BLOCK_START + version}\n ext.kotlin_version = '${gradlePluginVersion}'\n ${VERSION_BLOCK_END}`;
const version = versionMatch[0].replace(
"ext.kotlin_version = ",
""
);
const newVersion = `${
VERSION_BLOCK_START + version
}\n ext.kotlin_version = '${gradlePluginVersion}'\n ${VERSION_BLOCK_END}`;
fileContents = fileContents.replace(regex, newVersion);
}
fs.writeFileSync(file, fileContents);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cordova-plugin-videoeditorsdk",
"description": "A Cordova plugin for VideoEditor SDK. Integrate the video editor into your own HTML5, iOS or Android app - in minutes!",
"version": "3.2.0",
"version": "3.3.0",
"types": "./types/index.d.ts",
"main": "www/videoeditorsdk.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-videoeditorsdk" version="3.2.0">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-videoeditorsdk" version="3.3.0">
<name>VideoEditorSDK</name>
<description>A Cordova plugin for VideoEditor SDK. Integrate the video editor into your own HTML5, iOS or Android app - in minutes!</description>
<license>BSD-3-Clause</license>
Expand Down

0 comments on commit 4fef6e4

Please sign in to comment.