diff --git a/app/build.gradle b/app/build.gradle index ebce5b4..68740eb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ dependencies { // Banuba Video Editor SDK dependencies - def banubaSdkVersion = '1.48.2' + def banubaSdkVersion = '1.48.3' implementation "com.banuba.sdk:ffmpeg:5.3.0" implementation "com.banuba.sdk:camera-sdk:${banubaSdkVersion}" implementation "com.banuba.sdk:camera-ui-sdk:${banubaSdkVersion}" @@ -83,6 +83,6 @@ dependencies { // Photo Editor SDK dependency // WARNING! // Remove this dependency if you only use Video Editor SDK - def banubaPESdkVersion = '1.2.21' + def banubaPESdkVersion = '1.2.22' implementation("com.banuba.sdk:pe-sdk:${banubaPESdkVersion}") } diff --git a/app/src/main/java/com/banuba/example/integrationapp/MainActivity.kt b/app/src/main/java/com/banuba/example/integrationapp/MainActivity.kt index 84baeca..f31f2b1 100644 --- a/app/src/main/java/com/banuba/example/integrationapp/MainActivity.kt +++ b/app/src/main/java/com/banuba/example/integrationapp/MainActivity.kt @@ -1,6 +1,7 @@ package com.banuba.example.integrationapp import android.content.Intent +import android.graphics.Color import android.net.Uri import android.os.Bundle import android.util.Log @@ -16,12 +17,17 @@ import com.banuba.example.integrationapp.SampleApp.Companion.ERR_SDK_NOT_INITIAL import com.banuba.example.integrationapp.databinding.ActivityMainBinding import com.banuba.sdk.cameraui.data.PipConfig import com.banuba.sdk.core.ui.ext.visible +import com.banuba.sdk.core.utils.MAXIMUM_TEXT_SIZE import com.banuba.sdk.export.data.ExportResult import com.banuba.sdk.pe.BanubaPhotoEditor import com.banuba.sdk.pe.PhotoCreationActivity import com.banuba.sdk.pe.PhotoExportResultContract import com.banuba.sdk.ve.flow.VideoCreationActivity import com.banuba.sdk.ve.flow.VideoExportResultContract +import com.banuba.sdk.veui.data.templates.TemplateEffect +import com.banuba.sdk.veui.data.templates.TemplateEffectParams +import com.banuba.sdk.veui.domain.DecorAlignment +import com.banuba.sdk.veui.domain.LowerThirdData class MainActivity : AppCompatActivity() { @@ -76,7 +82,7 @@ class MainActivity : AppCompatActivity() { lifecycleScope, imageUri ) - openVideoEditorTrimmerWithSlideShow(slideShowList) + openVideoEditorWithSlideShow(slideShowList) } } @@ -211,12 +217,16 @@ class MainActivity : AppCompatActivity() { )) } - private fun openVideoEditorTrimmerWithSlideShow(videos: List) { + private fun openVideoEditorWithSlideShow(videos: List) { // Editor V2 is not available from Trimmer screen startVideoEditor( - VideoCreationActivity.startFromTrimmer( - this, - videos.toTypedArray() + VideoCreationActivity.startFromEditor( + context = this, + extras = extras, + predefinedVideos = videos.toTypedArray(), + // Pass predefined effects + predefinedLowerThirdData = createPredefinedLowerThird(), + predefinedTextEffect = createPredefinedTextEffect() ) ) } @@ -246,4 +256,30 @@ class MainActivity : AppCompatActivity() { photoEditorExportResult.launch(intent) } } + + private fun createPredefinedLowerThird(): LowerThirdData? = LowerThirdData( + firstText = "Adam Smith", + firstTextTypefaceIndex = 0, + firstTextColor = -1, + secondText = "Senior Software Engineer", + secondTextTypefaceIndex = 0, + secondTextColor = -1, + decorAlignment = DecorAlignment.LEFT, + backgroundColor = Color.BLACK + ) + + private fun createPredefinedTextEffect(): TemplateEffect? = TemplateEffect( + name = "What is your responsibilities?", + type = "text", + start = null, + end = null, + params = TemplateEffectParams( + x = 0.1f, + y = 0.2f, + fontSize = (MAXIMUM_TEXT_SIZE * 0.5f).toInt(), + colorHex = "#FFFFFF", + rotation = 0, + backgroundColorHex = null + ) + ) } diff --git a/app/src/main/java/com/banuba/example/integrationapp/VideoEditorModule.kt b/app/src/main/java/com/banuba/example/integrationapp/VideoEditorModule.kt index 3965de3..bbf3921 100644 --- a/app/src/main/java/com/banuba/example/integrationapp/VideoEditorModule.kt +++ b/app/src/main/java/com/banuba/example/integrationapp/VideoEditorModule.kt @@ -1,6 +1,7 @@ package com.banuba.example.integrationapp import android.content.Context +import android.graphics.Color import androidx.fragment.app.Fragment import com.banuba.sdk.arcloud.data.source.ArEffectsRepositoryProvider import com.banuba.sdk.arcloud.di.ArCloudKoinModule @@ -14,7 +15,10 @@ import com.banuba.sdk.gallery.di.GalleryKoinModule import com.banuba.sdk.playback.di.VePlaybackSdkKoinModule import com.banuba.sdk.ve.di.VeSdkKoinModule import com.banuba.sdk.ve.flow.di.VeFlowKoinModule +import com.banuba.sdk.veui.data.EditorConfig +import com.banuba.sdk.veui.data.LowerThirdConfig import com.banuba.sdk.veui.di.VeUiSdkKoinModule +import com.banuba.sdk.veui.domain.DecorAlignment import org.koin.android.ext.koin.androidContext import org.koin.core.context.startKoin import org.koin.core.qualifier.named @@ -62,5 +66,19 @@ private class SampleIntegrationKoinModule { ) { AudioBrowserMusicProvider() } + + single { + EditorConfig( + // Enable new experimental feature + lowerThirdConfig = LowerThirdConfig( + firstText = "Full Name", + maxSymbolsFirstText = 25, + secondText = "Occupation", + maxSymbolsSecondText = 50, + backgroundColor = Color.BLACK, + decorAlignment = DecorAlignment.LEFT + ) + ) + } } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7e39b47..41c39c1 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -79,7 +79,7 @@ android:layout_width="240dp" android:layout_height="wrap_content" android:layout_marginTop="16dp" - android:text="Open Video Editor - Trimmer" + android:text="Open Video Editor - Editor" android:textSize="11sp" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintLeft_toLeftOf="parent"