Skip to main content

Launching Video Editor

Prerequisites

The license token IS REQUIRED to use Video Editor SDK in your app.
Please check Requirements out guide if the license token is not set.

Update AndroidManifest

Add VideoCreationActivity in your AndroidManifest.xml file.

<activity android:name="com.banuba.sdk.ve.flow.VideoCreationActivity"
android:screenOrientation="portrait"
android:theme="@style/CustomIntegrationAppTheme"
android:windowSoftInputMode="adjustResize"
tools:replace="android:theme" />

VideoCreationActivity is used for brining together and managing Video Editor flow.
Each screen is implemented as an Android Fragment.

Next, add permissions

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

Network is used for downloading AR effects from AR Cloud and stickers from Giphy.

CustomIntegrationAppTheme is the custom implementation of VideoCreationTheme and is required for running VideoCreationActivity. Use this implementation for customizing visual appearance of Video Editor SDK i.e. colors, icons and more.

Configuration

Custom behavior of Video Editor SDK in your app is implemented by using Dependency Injection framework Koin.

Create new Kotlin class VideoEditorModule for configuring Video Editor SDK.
Next, add new class SampleIntegrationKoinModule for initializing and customizing Video Editor SDK features.

class VideoEditorModule {
...
private class SampleIntegrationKoinModule {
val module = module {
...
}
}
}

Add initialize method in VideoEditorModule class for initializing Video Editor SDK and specify SampleIntegrationKoinModule in the list of modules.

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,
)
}
}

Finally, initialize SDK in your Android Application onCreate() method.

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

...
}

Setup export

Video Editor can export a number of media files to meet your requirements. Implement ExportParamsProvider and provide List<ExportParams> where every ExportParams is a media file i.e. video or audio.
Check CustomExportParamsProvider implementation.

Initialize with license

Create an instance of BanubaVideoEditor by using the license token

val editorSDK = BanubaVideoEditor.initialize(LICENSE_TOKEN)

editorSDK is null when the license token is incorrect i.e. empty, truncated. If editorSDK is not null you can proceed and start video editor.

tip

Share the same instance of BanubaVideoEditor for Video Editor and Photo Editor SDK.

Next, we strongly recommend checking your license state before staring video editor

editorSDK.getLicenseState { isValid ->
if (isValid) {
// ✅ License is active, all good
// Start Video Editor SDK
} else {
// ❌ Use of Video Editor is restricted. License is revoked or expired.
}
}
warning

Video content unavailable screen will appear if the user starts Video Editor SDK with revoked or expired license.

Start editor

Start Video Editor SDK and handle exported results.
See example.

 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)