Skip to main content

Getting Started

A quick guide on how to easily get started with the VideoEditor SDK for Android. Your kick-off to delight your users with top-notch editing capabilities.

This document guides you through the process of integrating the VideoEditor SDK into your Android application.

Free Trial#

Our tech is modified to be used for testing purposes without a license key. To start testing just follow this Get Started guide and set the license path to
null
instead of entering the commercial license path. The editor will simply render a watermark over the preview and final results. And in case you need any technical assistance, make sure to reach out to us: https://img.ly/support. We'll be glad to help.

Prerequisites#

The following software is required:

  • Mac OS X, Windows, or Linux
  • Android Studio 3.0+
  • Android Minimum SDK 18+ (Android 4.3.0 released 24 July 2013)
  • Gradle Plugin Version 3.5+
  • Gradle Version 6.1.1+
  • Android Build Tools 29.0.2+
  • AndroidX
  • Kotlin Version 1.4.10+
  • License*

*The license is required to commercially use our tech in your application. Yet while testing no license file is required. For more information please see the FREE TRIAL note further up on this guide.

Supported Android versions#

The VideoEditor SDK supports Android 4.3.0+ API 18 as the minSdkVersion, but it must be compiled with compileSdkVersion and targetSdkVersion Level 28+ to support Android 9 and above.

Add your license file#

Before using any components of the VideoEditor SDK, you have to add your license file to your applications assets folder. The expected default name of the license file is “LICENSE”. In order to change this, see vesdk.licensePath option of imglyConfig in your build.gradle file. The license is digitally signed and can’t be altered without becoming invalid. Once the license file has been added the application will validate its presence upon launch.

Setting up the workspace#

Please ensure that our artifactory repository is listed in your repositories in the project's build.gradle file:

groovy
// Add the PESDK repository and plugin dependency
buildscript {
repositories {
google()
gradlePluginPortal()
maven { url 'https://artifactory.img.ly/artifactory/imgly' }
}
dependencies {
// Insert the latest SDK version number here. You will find it here https://github.com/imgly/pesdk-android-demo/releases
classpath 'ly.img.android.pesdk:plugin:9.0.0'
// Add the Kotlin plugin
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10'
}
}

You will also have to add the imgly plugin and imglyConfig into your module's build.gradle file:

groovy
// Apply the Android Plugin
apply plugin: 'com.android.application'
// Apply the IMGLYPlugin
apply plugin: 'ly.img.android.sdk'
// Apply Kotlin Plugin
apply plugin: 'kotlin-android'
// Configure the IMGLYPlugin
imglyConfig {
vesdk {
enabled true
licensePath 'vesdk_android_license'
}
// Define the modules you are need
modules {
// Add all the UI modules you are need
include 'ui:video-trim'
include 'ui:core'
include 'ui:text'
include 'ui:focus'
include 'ui:frame'
include 'ui:brush'
include 'ui:filter'
include 'ui:sticker'
include 'ui:overlay'
include 'ui:transform'
include 'ui:adjustment'
include 'ui:text-design'
// Add the serializer if you need
include 'backend:serializer'
// Add asset packs if you need
include 'assets:font-basic'
include 'assets:frame-basic'
include 'assets:filter-basic'
include 'assets:overlay-basic'
include 'assets:sticker-shapes'
include 'assets:sticker-emoticons'
}
}
// Do your Android Configurations... ex.
android {
/* Set the compileSdkVersion at 29 or greater and set the buildToolsVersion at '29.0.2' or greater.
* We can't provide support for Bugs, that are the result of older SDK versions.
*/
compileSdkVersion 29
buildToolsVersion '29.0.2'
defaultConfig {
/*
* Replace with your App-ID and keep sure that it match with your license!
* @see http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename
*/
applicationId "my.domain.application"
/* Set the minimum supported SDK Version to 16 (Android 4.1.0) or higher */
minSdkVersion 16
/* Set the target SDK Version at minimum to 29 or higher */
targetSdkVersion 29
}
/* Set Java Language level to Java 1.8+ */
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

Sync your project with the Gradle files after every edit! For more information about Gradle, please take a look at the Android Developer Documentation

Android Permissions#

The VideoEditor SDK requires two permissions: The "Write access to external storage" and the "Camera" permission (if you include the Camera module). You can grant this permissions yourself otherwise the SDK will automatically grant these permissions

Please take a look at the hint in the next step in order to integrate the Android 6.0 permission request correct!

Integration#

If you want to open the video editor look at this example:

class KVideoEditorDemoActivity : Activity(), PermissionRequest.Response {
companion object {
const val VESDK_RESULT = 1
const val GALLERY_RESULT = 2
}
// Important permission request for Android 6.0 and above, don't forget to add this!
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
PermissionRequest.onRequestPermissionsResult(requestCode, permissions, grantResults)
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
}
override fun permissionGranted() {}
override fun permissionDenied() {
/* TODO: The Permission was rejected by the user. The Editor was not opened,
* Show a hint to the user and try again. */
}
// Create a empty new SettingsList and apply the changes on this referance.
// If you include our asset Packs and use our UI you also need to add them to the UI,
// otherwise they are only available for the backend (like Serialisation)
// See the specific feature sections of our guides if you want to know how to add our own Assets.
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private fun createVesdkSettingsList() =
VideoEditorSettingsList()
.configure<UiConfigFilter> {
it.setFilterList(FilterPackBasic.getFilterPack())
}
.configure<UiConfigText> {
it.setFontList(FontPackBasic.getFontPack())
}
.configure<UiConfigFrame> {
it.setFrameList(FramePackBasic.getFramePack())
}
.configure<UiConfigOverlay> {
it.setOverlayList(OverlayPackBasic.getOverlayPack())
}
.configure<UiConfigSticker> {
it.setStickerLists(
StickerPackEmoticons.getStickerCategory(),
StickerPackShapes.getStickerCategory()
)
}
.configure<VideoEditorSaveSettings> {
it.setOutputToGallery(Environment.DIRECTORY_DCIM)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
openSystemGalleryToSelectAnVideo()
}
fun openSystemGalleryToSelectAnVideo() {
val intent = Intent(Intent.ACTION_PICK)
intent.setDataAndType(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,"video/*")
if (intent.resolveActivity(packageManager) != null) {
startActivityForResult(intent, GALLERY_RESULT)
} else {
Toast.makeText(
this,
"No Gallery APP installed",
Toast.LENGTH_LONG
).show()
}
}
fun openEditor(inputImage: Uri?) {
val settingsList = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
createVesdkSettingsList()
} else {
Toast.makeText(this, "Video support needs Android 4.3", Toast.LENGTH_LONG).show()
return
}
settingsList.configure<LoadSettings> {
it.source = inputImage
}
settingsList[LoadSettings::class].source = inputImage
VideoEditorBuilder(this)
.setSettingsList(settingsList)
.startActivityForResult(this, VESDK_RESULT)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent) {
super.onActivityResult(requestCode, resultCode, intent)
if (resultCode == RESULT_OK && requestCode == GALLERY_RESULT) {
// Open Editor with some uri in this case with an video selected from the system gallery.
openEditor(intent.data)
} else if (resultCode == RESULT_OK && requestCode == VESDK_RESULT) {
// Editor has saved an Video.
val data = EditorSDKResult(intent)
Log.i("VESDK", "Source video is located here ${data.sourceUri}")
Log.i("VESDK", "Result video is located here ${data.resultUri}")
// TODO: Do something with the result image
// OPTIONAL: read the latest state to save it as a serialisation
val lastState = data.settingsList
try {
IMGLYFileWriter(lastState).writeJson(
File(
Environment.getExternalStorageDirectory(),
"serialisationReadyToReadWithPESDKFileReader.json"
)
)
} catch (e: IOException) {
e.printStackTrace()
}
} else if (resultCode == RESULT_CANCELED && requestCode == VESDK_RESULT) {
// Editor was canceled
val data = EditorSDKResult(intent)
val sourceURI = data.sourceUri
// TODO: Do something with the source...
}
}
}

Sample Application#

You can access the source code for our demo application from our demo repository.