Save Recorded Video

Learn how to save recorded video to gallery

Once a recording is finished, this call will save the recorded content to disk.

For video recording : On iOS this saves directly to the camera roll. On Android we create an app folder album and copy over there

For Gif recording : This saves gif to Application.PersistentPath.

On Android, Make sure you enable Uses Save Preview from Screen Recorder Kit Settings. Else it won't get saved to gallery as it needs permissions declared in the manifest. We do it automatically, if you enable it in Screen Recorder Kit settings.

using VoxelBusters.ScreenRecorderKit;

IScreenRecorder recorder;
//... Create instance for IScreenRecorder via ScreenRecorderBuilder

void RegisterListeners()
{
    recorder.SetOnRecordingAvailable((result) =>
    {
        string path = result.Data as string;
        Debug.Log($"File path: {path}");
        SaveRecording();
    });
}
void SaveRecording()
{
    recorder.SaveRecording(null, (result, error) =>
    {
        if(error == null)
        {
            Debug.Log("Saved recording successfully :" + result.Path);
        }
        else
        {
            Debug.Log($"Failed saving recording [{error}]");
        }
    });
}

Error Codes

Last updated