Background Export
VideoEditor SDK supports exporting videos in the background using WorkManager
. Background export requires the backend:headless
module. Refer to our documentation on how to include the module in your project.
Start Editor#
For the sake of this example, we load a video from the resources into the video editor.
Configure the VideoEditorSaveSettings
to set the outputMode
to only export the SettingsList
(instead of the video). This SettingsList
will be used later to export the video in the background.
Handle Result#
The result from the editor is received in the onActivityResult()
method. EditorSDKResult
wraps around the intent and provides a convenient API to check the result. Here, we obtain the SettingsList
using EditorSDKResult.settingsList
and create a WorkRequest
using the DocumentRenderWorker.createWorker()
method. This WorkRequest
is then enqueued in the WorkManager
for background processing.
Note the usage of the use()
method on the SettingsList
. It automatically releases the SettingsList
after executing the block so we don't have to release it manually.
Observe Progress#
Here, we observe progress information of the scheduled background exports using the getWorkInfosByTagLiveData()
method.
DocumentRenderWorker
uses the DocumentRenderWorker.DEFAULT_WORK_INFO_TAG
tag and the progress is obtained using the DocumentRenderWorker.FLOAT_PROGRESS_KEY
key.