Face AR and AR Cloud products
Banuba Face AR SDK product is used on camera and editor screens for applying various AR effects while making video content.
Overview
Any Face AR effect is a folder that includes a number of files required for Face AR SDK to play this effect.
Make sure preview.png
file is included in effect folder. You can use this file as a preview for AR effect.
Integrate Face AR
Banuba Face AR SDK
integration is included in the Github sample.
Follow next steps to integrate Banuba Face AR SDK
into your project.
First, add Gradle com.banuba.sdk:effect-player-adapter
dependency in app gradle file.
def banubaSdkVersion = '1.36.4'
...
+ implementation "com.banuba.sdk:effect-player-adapter:${banubaSdkVersion}"
...
Add BanubaEffectPlayerKoinModule().module
in the VideoEditorModule
startKoin {
androidContext(this@IntegrationApp)
modules(
...
+ BanubaEffectPlayerKoinModule().module
)
}
Manage effects
There are 2 options for managing AR effects:
- Store all effects in assets/bnb-resources/effects folder in the app.
- Use AR Cloud for storing effects on a server.
You can use both options i.e. store just a few AR effects in assets
and 100 or more AR effects on AR Cloud
.
Integrate AR Cloud
AR Cloud
is a cloud solution for storing Banuba Face AR effects on the server and used by Face AR and Video Editor products.
Any AR effect downloaded from AR Cloud
is cached on the user's device.
Follow next steps to integrate AR Cloud
into your project.
First, add Gradle com.banuba.sdk:ar-cloud
dependency in app gradle file.
def banubaSdkVersion = '1.36.4'
...
+ implementation "com.banuba.sdk:ar-cloud:${banubaSdkVersion}"
...
Next, add ArCloudKoinModule
module to Koin modules.
startKoin {
...
modules(
VeSdkKoinModule().module,
...
+ ArCloudKoinModule().module,
...
)
}
Next, override ArEffectsRepositoryProvider
in VideoEditorModule.
single<ArEffectsRepositoryProvider>(createdAtStart = true) {
ArEffectsRepositoryProvider(
arEffectsRepository = get(named("backendArEffectsRepository")),
ioDispatcher = get(named("ioDispatcher"))
)
}
Change order effects
By default, all AR effects are listed in alphabetical order. AR effects from assets
are listed in order.
Create new class CustomMaskOrderProvider
and implement OrderProvider
to provide custom order.
class CustomMaskOrderProvider : OrderProvider {
override fun provide(): List<String> = listOf("Background", "HeadphoneMusic")
}
These are names of specific directories in assets/bnb-resources/effects
or on AR Cloud
.
Next, use CustomMaskOrderProvider
in VideoEditorModule
single<OrderProvider>(named("maskOrderProvider")) {
CustomMaskOrderProvider()
}
Disable Face AR SDK
Video Editor SDK can be used without Face AR SDK.
Remove BanubaEffectPlayerKoinModule().module
from VideoEditorModule
startKoin {
androidContext(this@IntegrationApp)
modules(
...
- BanubaEffectPlayerKoinModule().module
)
}
and remove Gradle dependency com.banuba.sdk:effect-player-adapter
...
- implementation "com.banuba.sdk:effect-player-adapter:${banubaSdkVersion}"
...
Integrate Beauty effect
Video Editor SDK has built in integration with beautification effect - Beauty.
The user interacts with Beauty
effect by clicking on specific button on camera screen.
Beauty
is not available in the list of all AR effects on the screen. Additionally, it is required to store the effect in assets
and keep name Beauty
with no changes.
Please move this effect while integrating Video Editor SDK into your project if you use Face AR product.