Skip to main content
VESDK/Android

Record a video using a camera app

The Android way of delegating actions to other applications is to invoke an Intent that describes what you want done. This process involves three pieces: The Intent itself, a call to start the external Activity, and some code to handle the video when focus returns to your application.

We provide the ExternalVideoCaptureBuilder to let you start a video camera application with ease. We recommend using the system camera controller for the best quality results.

ExternalVideoCaptureBuilder()
.startActivityForResult(this@MainActivity, VIDEO_ACTIVITY_RESULT)

Edit the video#

The Android Camera application returns the video in the Intent delivered to onActivityResult() as a Uri pointing to the video location in storage. The following code retrieves this video and pass it to the VideoEditor

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK && requestCode == VIDEO_ACTIVITY_RESULT) {
val videoUri = data?.data
val settingsList = ExampleConfigUtility.createInitialVESDKSettingsList()
settingsList
.getSettingsModel(LoadSettings::class.java)
.source = videoUri
VideoEditorBuilder(this@KVideoCameraActivity)
.setSettingsList(settingsList)
.startActivityForResult(this@KVideoCameraActivity, EDITOR_ACTIVITY_RESULT);
}
}