Configure Border Frames
VideoEditor SDK supports several configuration options for the FrameToolPanel
allowing flexible adaptation to different needs and use cases.
Set available tools#
By default, all available frame tools are enabled.
In our example, we remove the option to change the frame width and only allow replacing it and changing its opacity. We do this by setting the optionList
and adding only the tools that we need. Alternatively, this could also be done by removing the FrameOption
with the id OPTION_WIDTH
from the optionList
.
Set allowed actions#
The quickOptionList
contains all the actions that users can perform on a frame. It also contains SpaceItem
s that are used to space out the actions. In our example, we clear the quickOptionList
as we don't want to allow any actions.
class VideoFrameConfiguration(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 constructorval 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<UiConfigFrame> {// By default all available frame tools are enabled// For this example only a couple are enabledval tools = listOf(FrameOption(FrameOption.OPTION_REPLACE,ly.img.android.pesdk.ui.frame.R.string.pesdk_frame_button_replace,ImageSource.create(ly.img.android.pesdk.ui.R.drawable.imgly_icon_replace)),FrameOption(FrameOption.OPTION_OPACITY,ly.img.android.pesdk.ui.frame.R.string.pesdk_frame_button_opacity,ImageSource.create(ly.img.android.pesdk.ui.R.drawable.imgly_icon_option_opacity)))it.optionList.set(tools)// By default the editor has all available overlay actions for this tool enabled// For this example, we remove all the actionsit.quickOptionsList.clear()}// Start the video editor using VideoEditorBuilder// The result will be obtained in onActivityResult() corresponding to EDITOR_REQUEST_CODEVideoEditorBuilder(activity).setSettingsList(settingsList).startActivityForResult(activity, EDITOR_REQUEST_CODE)// Release the SettingsList once donesettingsList.release()}override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {intent ?: returnif (requestCode == EDITOR_REQUEST_CODE) {// Wrap the intent into an EditorSDKResultval result = EditorSDKResult(intent)when (result.resultStatus) {EditorSDKResult.Status.CANCELED -> showMessage("Editor cancelled")EditorSDKResult.Status.EXPORT_DONE -> showMessage("Result saved at ${result.resultUri}")else -> {}}}}}