FAQ
These are the answers to the most common questions asked about our SDK.
- I want to start VideoEditor with a preselected audio track
- How to change drafts configuration
- How to add other text fonts that are used in the editor screen
- Optimizing app size
- How do I change the language (how do I add new locale support)
- How do I integrate custom FFmpeg dependency in app?
- FFmpeg build issue(Error compressed Native Libs)
I want to start VideoEditor with a preselected audio track
To open Video Editor SDK you should create an intent by utilizing any avilable function inside VideoCreationActivity: startFromCamera(), startFromTrimmer() or startFromEditor(). All these functions have an argument called audioTrackData where you should pass preselected audio track or null (by default). For example, to open an SDK from the camera screen with the track use the code snippet below:
startActivity(
VideoCreationActivity.startFromCamera(
context = applicationContext,
audioTrackData = preselectedTrackData
)
)
audioTrackData is an object of TrackData class
data class TrackData(
val id: UUID,
val title: String,
val localUri: Uri,
val artist: String? = null
)
How to change drafts configuration
Drafts are enabled by default, asks the user to save a draft before leave any VideoEditor screen. If you need to change drafts configuration you should add the code below in the VideoEditorKoinModule
:
override val draftConfig: BeanDefinition<DraftConfig> = factory(override = true) {
DraftConfig.ENABLED_ASK_TO_SAVE
}
You can choose one of these options:
ENABLED_ASK_TO_SAVE
- drafts enabled, asks the user to save a draftENABLED_ASK_IF_SAVE_NOT_EXPORT
- drafts enabled, asks the user to save a draft without exportENABLED_SAVE_BY_DEFAULT
- drafts enabled, saved by default without asking the userDISABLED
- disabled drafts
How to add other text fonts that are used in the editor screen
To add other text fonts that are used in the editor screen follow the next steps:
-
Add font files to the
app/src/main/res/font/
directory; -
Add fonts names to the
strings.xml
resource file:<string name="font_1_title" translatable="false">Font 1 Title</string>
<string name="font_N_title" translatable="false">Font N Title</string> -
Add
font_resources.xml
with fonts array declaration to theapp/src/main/res/values/
directory. The format offont_resources.xml
should be the next one:<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="font_resources">
<item>@array/font_1_resource</item> <!-- link to the font description array -->
<item>@array/font_N_resource</item>
</array>
<array name="font_1_resource">
<item>@string/font_1_title</item> <!-- font name -->
<item>@font/font_1</item> <!-- link to the font file -->
</array>
<array name="font_N_resource">
<item>@string/font_N_title</item>
<item>@font/font_N</item>
</array>
</resources> -
The final step is to pass your custom
font_resources
id to theMainTextOnVideoTypefaceProvider
in theSampleIntegrationKoinModule
to override the default implementation:single<TextOnVideoTypefaceProvider> {
MainTextOnVideoTypefaceProvider(
context = get(),
fontsArrayResId = R.array.font_resources
)
}
Optimizing app size
The easiest way to gain immediate app size savings when publishing to Google Play is by uploading your app as an Android App Bundle, which is a new upload format that includes all your app’s compiled code and resources. Google Play’s new app serving model then uses your app bundle to generate and serve optimized APKs for each user’s device configuration, so they download only the code and resources they need to run your app.
As a result, the final size of our library for one of the platform types (armeabi-v7a
, arm64-v8a
, x86
, x86_64
) will be 24-26 MB less than indicated in the documentation
How do I change the language (how do I add new locale support)?
There is no special language switching mechanism in the Video Editor SDK.
Out of the box, the VE SDK supports English
locale. If you need to support any other locales, you can do it according to the standard Android way.
See how Create locale directories and resource files for more details.
After adding a new locale resource file into your application with integrated VE SDK,
you need to re-define the VE SDK strings keys with new locale string values.
To do that you need to add all needed string keys in the new locale strings.xml
file.
The newly added locale will be applied after the device language is changed by system settings.
If you need to change language programmatically in your application, see the next links how it can be done: one, two
FFmpeg build issue
Below are the steps to resolve the issue while building the project.
- Add the
android.bundle.enableUncompressedNativeLibs=false
in thegradle.properties
android.bundle.enableUncompressedNativeLibs=false
- Add
android:extractNativeLibs="true"
inAndroidManifest.xml
file
<application
...
android:extractNativeLibs="true"
...
>
How to integrate custom FFmpeg dependency.
Check out step-by-step guide to integrate custom FFmpeg dependency.