Skip to main content

Integration Video Editor on Android

Installation​

Add the Banuba repository to your project using either Groovy or Kotlin DSL:

Groovy (in project's build.gradle)

allprojects {
repositories {
maven {
name = "nexus"
url = uri("https://nexus.banuba.net/repository/maven-releases")
}
...
}
}

Kotlin (in settings.gradle.kts)

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven {
name = "nexus"
url = uri("https://nexus.banuba.net/repository/maven-releases")
}
}
}

Add Packaging Options Settings​

Specify the following packaging options in your build gradle file:

android {
...
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
...
}

Add dependencies​

Specify dependencies in the app gradle file.

    def banubaSdkVersion = '1.55.0'

implementation "com.banuba.sdk:ffmpeg:5.3.0"
implementation "com.banuba.sdk:camera-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:camera-ui-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:core-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:core-ui-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:ve-flow-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:ve-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:ve-ui-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:ve-gallery-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:ve-effects-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:effect-player-adapter:${banubaSdkVersion}"
implementation "com.banuba.sdk:ar-cloud:${banubaSdkVersion}"
implementation "com.banuba.sdk:ve-audio-browser-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:ve-export-sdk:${banubaSdkVersion}"
implementation "com.banuba.sdk:ve-playback-sdk:${banubaSdkVersion}"

Add kotlin-parcelize plugin into plugins section of the gradle file.

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
}

AndroidManifest Updates​

Add the following to your AndroidManifest.xml:

  1. VideoCreationActivity – orchestrates the video editor screens
<activity android:name="com.banuba.sdk.ve.flow.VideoCreationActivity"
android:screenOrientation="portrait"
android:theme="@style/VideoCreationTheme"
android:windowSoftInputMode="adjustResize"
tools:replace="android:theme" />

Important
Starting with version 1.51.0, themes are included in the SDK. For earlier versions, see the Removed styles section in the changelog.

  1. Network permissions (optional)– only required if using Giphy stickers or downloading AR effects from the cloud.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

Note: You'll also need a custom VideoCreationTheme example to style the editor UI.

Initialize SDK​

Recommended

Simplified integration is available starting with version 1.55.0. It does not require working with Koin DI directly, and color filter textures are bundled within the SDK.

Initialize VideoEditorSDK with your license token in your Application class:

import android.app.Application
import com.banuba.sdk.audiobrowser.data.AudioBrowserMusicProvider
import com.banuba.sdk.audiobrowser.di.AudioBrowserKoinModule
import com.banuba.sdk.effectplayer.adapter.BanubaEffectPlayerKoinModule
import com.banuba.sdk.gallery.di.GalleryKoinModule
import com.banuba.sdk.ve.flow.VideoEditorSDK

class SampleApp : Application() {

var editorSdk: VideoEditorSDK? = null

fun initSdk() {
if (editorSdk == null) {
editorSdk = VideoEditorSDK.Builder(applicationContext).apply {
// Optional AudioBrowser module for music providers: BanubaMusic, Soundstripe, Local
addModule(AudioBrowserKoinModule().module)
// Required if AudioBrowser is added.
setMusicTrackProvider(AudioBrowserMusicProvider())

// Optional Banuba Gallery module for selecting videos and photos from device
addModule(GalleryKoinModule().module)

// Optional module to enable Face AR product
addModule(BanubaEffectPlayerKoinModule().module)
}.initialize(LICENSE_TOKEN)
}

if (editorSdk == null) {
// Token you provided is not correct - empty or truncated
}
}
}

Call editorSdk?.release() and set editorSdk = null when you need to release Video Editor SDK, for example before opening Photo Editor SDK.

warning
  1. initialize returns null if the license token is invalid – verify your token
  2. Check license activation before starting the editor.
  3. Expired/revoked licenses show a "Video content unavailable" screen

ve expired

Then launch the Video Editor with VideoCreationActivity.

Koin Module Setup​

Deprecated

The Koin-based integration is deprecated starting with version 1.55.0. It still works and there is no urgent need to migrate, but future SDK development will focus on the new simplified integration described in the Initialize SDK section.

👉 Read the 1.55.0 release notes and migration guide →

  1. Create VideoEditorModule to initialize and customize the Video Editor SDK.
  2. Inside it, add SampleIntegrationKoinModule with your customizations:
class VideoEditorModule {
...
private class SampleIntegrationKoinModule {
val module = module {
single<ArEffectsRepositoryProvider>(createdAtStart = true) {
ArEffectsRepositoryProvider(
arEffectsRepository = get(named("backendArEffectsRepository"))
)
}

single<ContentFeatureProvider<TrackData, Fragment>>(
named("musicTrackProvider")
) {
AudioBrowserMusicProvider()
}

...
}
}
}
  1. Include this module during SDK initialization:
fun initialize(applicationContext: Context) {
startKoin {
androidContext(applicationContext)
allowOverride(true)

// pass the customized Koin module that implements required dependencies. Keep order of modules
modules(
VeSdkKoinModule().module,
VeExportKoinModule().module,
VePlaybackSdkKoinModule().module,
AudioBrowserKoinModule().module, // use this module only if you bought it
ArCloudKoinModule().module,
VeUiSdkKoinModule().module,
VeFlowKoinModule().module,
GalleryKoinModule().module,
BanubaEffectPlayerKoinModule().module,

+ SampleIntegrationKoinModule().module,
)
}
}

Launch​

Initialize VideoEditorModule in your Application class.

override fun onCreate() {
super.onCreate()
VideoEditorModule().initialize(this)

}

Create SDK instance of EditorSdk with your license token.

val videoEditorSDK = EditorSdk.initialize(LICENSE_TOKEN)
warning
  1. Returns nulll if the license token is invalid – verify your token
  2. Check license activation before starting the editor.
  3. Expired/revoked licenses show a "Video content unavailable" screen

ve expired

This example launches from camera (full implementation):

 val createVideoRequest =
registerForActivityResult(IntegrationAppExportVideoContract()) { exportResult ->
exportResult?.let {
//handle ExportResult object
}
}

val intent = VideoCreationActivity.startFromCamera(
context = this,
// set PiP video configuration
pictureInPictureConfig = null,
// setup what kind of action you want to do with VideoCreationActivity
// setup data that will be acceptable during export flow
additionalExportData = null,
// set TrackData object if you open VideoCreationActivity with preselected music track
audioTrackData = null
)
createVideoRequest.launch(intent)