Skip to main content


VideoEditor SDK supports serialization and deserialization, allowing your users to save and revise their work at any time. Deserialization requires the backend:serializer module. Refer to our documentation on how to include the module in your project.

Restoring a settings file#

For the sake of this example, we load a video from the resources into the video editor.

To restore an editor instance to a previous state, we read the serialization from a JSON file using the IMGLYFileReader.readJson() method. Since reading a file is an IO Operation, we do this inside of a coroutine on the IO Dispatcher.

The IMGLYFileReader.readJson() method is overloaded to also accept a String or a ByteArray to read into a SettingsList.

class VideoDeserialization(private val activity: AppCompatActivity) : Example(activity) {
override fun invoke() {
// In this example, we need access to the Uri(s) after the editor is closed
// so we pass true 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)
activity.lifecycleScope.launch {
withContext(Dispatchers.IO) {
val file = File(activity.getExternalFilesDir(null), "vesdk.json")
if (file.exists()) {
try {
// Deserialize JSON file and read it into SettingsList
} catch (e: IOException) {
withContext(Dispatchers.Main) {
showMessage("Error reading serialisation")
} else {
withContext(Dispatchers.Main) {
showMessage("Serialisation file not found")
// Start the video editor using VideoEditorBuilder
// The result will be obtained in onActivityResult() corresponding to EDITOR_REQUEST_CODE
.startActivityForResult(activity, EDITOR_REQUEST_CODE)
// Release the SettingsList once done
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
super.onActivityResult(requestCode, resultCode, intent)
intent ?: return
if (requestCode == EDITOR_REQUEST_CODE) {
val result = EditorSDKResult(intent)
when (result.resultStatus) {
EditorSDKResult.Status.CANCELED -> showMessage("Editor cancelled")
EditorSDKResult.Status.EXPORT_DONE -> showMessage("Result saved at ${result.resultUri}")
else -> {