Skip to main content
Language:

Configure Blur

VideoEditor SDK supports several configuration options for the FocusToolPanel allowing flexible adaptation to different needs and use cases.

Set available modes#

The default configuration includes several different modes. In this example, we only want to provide radial and mirrored blurs.

Note that optionList is an instance of DataSourceArrayList and allows other operations that can be used to modify the list.

File:
class VideoFocusConfiguration(private val activity: AppCompatActivity) : Example(activity) {
override fun invoke() {
// In this example, we do not need access to the Uri(s) after the editor is closed
// so we pass false in the constructor
val settingsList = VideoEditorSettingsList(false)
// Set the source as the Uri of the video to be loaded
.configure<LoadSettings> {
it.source = activity.resourceUri(R.raw.skater)
}
settingsList.configure<UiConfigFocus> {
// By default the editor has all focus modes enabled
// For this example, only the given selection should
// be enabled.
val focusOptions = listOf(
FocusOption(FocusToolPanel.OPTION_NO_FOCUS),
FocusOption(FocusToolPanel.OPTION_RADIAL),
FocusOption(FocusToolPanel.OPTION_MIRRORED)
)
it.optionList.set(focusOptions)
}
// Start the video editor using VideoEditorBuilder
// The result will be obtained in onActivityResult() corresponding to EDITOR_REQUEST_CODE
VideoEditorBuilder(activity)
.setSettingsList(settingsList)
.startActivityForResult(activity, EDITOR_REQUEST_CODE)
// Release the SettingsList once done
settingsList.release()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
intent ?: return
if (requestCode == EDITOR_REQUEST_CODE) {
// Wrap the intent into an EditorSDKResult
val result = EditorSDKResult(intent)
when (result.resultStatus) {
EditorSDKResult.Status.CANCELED -> showMessage("Editor cancelled")
EditorSDKResult.Status.EXPORT_DONE -> showMessage("Result saved at ${result.resultUri}")
else -> {
}
}
}
}
}