Skip to content

Latest commit

 

History

History
228 lines (188 loc) · 9.33 KB

quickstart.md

File metadata and controls

228 lines (188 loc) · 9.33 KB

Quickstart Integration Guide

Concepts

  • Export - the process of making video file in video editor.

  • Slideshow - the feature that allows to create short video from single or multiple images.

  • PIP - short Picture-in-Picture feature.

  • Trimmer - a screen where the user can trim, merge, change aspects of videos

  • Editor - a screen where the user can manage effects and audio. The next screen after trimmer.

  • Installation

  • Resources

  • Configuration

  • Launch

  • Advanced integration

Installation

GitHub Packages is used for downloading Android Video Editor SDK modules.

First, add repositories to gradle file in allprojects section.

...

allprojects {
    repositories {
        ...

       maven {
          name = "GitHubPackages"
          url = uri("https://maven.pkg.github.com/Banuba/banuba-ve-sdk")
          credentials {
             username = "Banuba"
             password = "\u0038\u0036\u0032\u0037\u0063\u0035\u0031\u0030\u0033\u0034\u0032\u0063\u0061\u0033\u0065\u0061\u0031\u0032\u0034\u0064\u0065\u0066\u0039\u0062\u0034\u0030\u0063\u0063\u0037\u0039\u0038\u0063\u0038\u0038\u0066\u0034\u0031\u0032\u0061\u0038"
          }
       }
       maven {
          name = "ARCloudPackages"
          url = uri("https://maven.pkg.github.com/Banuba/banuba-ar")
          credentials {
             username = "Banuba"
             password = "\u0038\u0036\u0032\u0037\u0063\u0035\u0031\u0030\u0033\u0034\u0032\u0063\u0061\u0033\u0065\u0061\u0031\u0032\u0034\u0064\u0065\u0066\u0039\u0062\u0034\u0030\u0063\u0063\u0037\u0039\u0038\u0063\u0038\u0038\u0066\u0034\u0031\u0032\u0061\u0038"
          }
       }
       maven {
          name "GitHubPackagesEffectPlayer"
          url "https://maven.pkg.github.com/sdk-banuba/banuba-sdk-android"
          credentials {
             username = "sdk-banuba"
             password = "\u0067\u0068\u0070\u005f\u004a\u0067\u0044\u0052\u0079\u0049\u0032\u006d\u0032\u004e\u0055\u0059\u006f\u0033\u0033\u006b\u0072\u0034\u0049\u0069\u0039\u0049\u006f\u006d\u0077\u0034\u0052\u0057\u0043\u0064\u0030\u0052\u0078\u006d\u0045\u0069"
          }
       }

        ...
    }
}

Next, specify a list of dependencies in gradle file.

    def banubaSdkVersion = '1.37.1'

    implementation "com.banuba.sdk:ffmpeg:5.1.3"
    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}"

Additionally, make sure the following plugins are in your app gradle file.

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-parcelize'

Resources

Video Editor SDK uses a lot of resources required for running in the app.
Please make sure all these resources exist in your project.

  1. drawable-xhdpi, drawable-xxhdpi, drawable-xxxhdpi are visual assets for color filter previews.

  2. themes.xml includes implementation of VideoCreationTheme of Video Editor SDK.

Configuration

Add VideoCreationActivity in AndroidManifest.xml files.

<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 a number of Video Editor screens in a certain flow.
Each screen is implemented as a Android Fragment.

Next, allow Network by adding 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.

Custom implementation of VideoCreationTheme is required for running VideoCreationActivity for customizing visual appearance of Video Editor SDK i.e. colors, icons and more.
See example.

Create new Kotlin class VideoEditorModule in your project for initializing and customizing Video Editor SDK features.

Next, add new class SampleIntegrationKoinModule for customizing Video Editor SDK features.

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

Next, add method to initialize Video Editor SDK modules and add SampleIntegrationKoinModule to 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,
            )
        }
    }

Launch

Initialize VideoEditorModule in Application.

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

Next, create instance of BanubaVideoEditor by using the license token

val videoEditorSDK = BanubaVideoEditor.initialize(LICENSE_TOKEN)

❗ Important

  1. Instance videoEditorSDK is null if the license token is incorrect. In this case you cannot use photo editor. Check your license token.
  2. It is highly recommended to check if the license is active before starting Photo Editor.

❗ Video content unavailable screen will appear if you start Video Editor SDK with revoked or expired license.

Video Editor supports multiple launch methods described in this guide.

The following implementation starts Video Editor from camera screen.

 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)

Advanced integration

Video editor has built in UI/UX experience and provides a number of customizations you can use to meet your requirements.

AVAILABLE
✅ Use your branded icons
✅ Use you branded colors
✅ Change text styles i.e. font, color
✅ Localize and change text resources. Default locale is 🇺🇸
✅ Make content you want i.e. a number of video with different resolutions and durations, an audio file. See details
✅ Masks and filters order.

NOT AVAILABLE
❌ Change layout
❌ Change order of screens after entry point

Visit Advanced integration guide to know more about features and customizations.