This doc explains how to reduce the size of Video Editor and Photo Editor SDK in your app bundle.
Video Editor SDK includes Face AR product for playing AR effects. Face AR includes many heavy resources that take space in the SDK.
Photo Editor SDK incudes Face AR product and an exclusive effect that allows to apply various features.
The biggest part of the SDK size are Face AR resources and Photo Editor effect which is around 70%
. This number depends on product versions
Integrate SDKs with cut resources. Download and put these resource in runtime.
All changes are available in PullRequest
com.banuba.sdk:effect-player-adapter
def banubaSdkVersion = '1.38.0'
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}") {
// As a result only sdk_core, sdk_api will be used
exclude group: 'com.banuba.sdk', module: 'scripting'
exclude group: 'com.banuba.sdk', module: 'face_tracker'
exclude group: 'com.banuba.sdk', module: 'effect_player'
exclude group: 'com.banuba.sdk', module: 'skin'
exclude group: 'com.banuba.sdk', module: 'eyes'
exclude group: 'com.banuba.sdk', module: 'lips'
exclude group: 'com.banuba.sdk', module: 'hair'
exclude group: 'com.banuba.sdk', module: 'background'
exclude group: 'com.banuba.sdk', module: 'occlusion'
exclude group: 'com.banuba.sdk', module: 'visual_clip'
exclude group: 'com.banuba.sdk', module: 'correctors'
exclude group: 'com.banuba.sdk', module: 'makeup'
exclude group: 'com.banuba.sdk', module: 'brows'
exclude group: 'com.banuba.sdk', module: 'banuba_sdk_resources'
}
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}"
def banubaPESdkVersion = '1.2.8'
implementation("com.banuba.sdk:pe-sdk:${banubaPESdkVersion}")
Exclude Main Photo Editor effect delivered in main build from Android assets
. Otherwise the effect will be bundled into your apk from the SDK. This effect is also in bnb-resources.zip
file
aaptOptions {
ignoreAssetsPattern "!photo_editor"
}
Put bnb-resources.zip
file to your server. This file contains Face AR resources and Photo Editor effect
Request extracting resources for Video Editor SDK by using new config in Video Editor Koin module
val module = module {
...
single(named("extractExternalResources")) { true }
}
Request extract resources for Photo Editor SDK by using new property in PhotoEditorConfig. And pass this config in start method.
val extras = Bundle().apply {
putBoolean(PhotoCreationActivity.EXTRA_EXTRACT_EXTERNAL_RESOURCES, true)
}
// Start Photo Editor SDK
startPhotoEditor(
PhotoCreationActivity.startFromGallery(
this@MainActivity,
extras = extras
)
)
In app runtime download bnb-resources.zip
and put it to data/data/$package/files
dir. See screenshot.