Skip to main content
Language

Serialization

VideoEditor SDK supports serialization and deserialization, allowing your users to save and revise their work at any time. Serialization requires the backend:serializer 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 for serialization. You can choose to skip this step and both the video as well as the SettingsList will be exported.

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 launch a coroutine using Dispatchers.IO. Inside the coroutine, we create a file, obtain the SettingsList (via EditorSDKResult.settingsList), and serialize it using the IMGLYFileWriter.writeJson() method. You can optionally serialize the SettingsList into a String (using IMGLYFileWriter.writeJsonAsString()) or a ByteArray (using IMGLYFileWriter.writeJsonAsBytes()).

For details on the JSON structure you can download our schema.

For further processing, you can upload the serialization to a remote server (compare Save Video To Remote URL) to make the editor state available on other devices as well.

The next section explains how to restore the editor state by deserializing these settings.