Save Recorded Video

Learn how to save recorded video to gallery

Once you recording state changes to ReplayKitRecordingState.Available the file can be saved to gallery. This saves the recorded file to gallery.

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

On Android, Make sure you enable External Storage permissions from Replay 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 Replay Kit settings.

public void SavePreview() //Saves preview to gallery
{
if(ReplayKitManager.IsPreviewAvailable())
{
ReplayKitManager.SavePreview((error) =>
{
Debug.Log("Saved preview to gallery with error : " + ((error == null) ? "null" : error));
});
}
else
{
Debug.LogError("Recorded file not yet available. Please wait for ReplayKitRecordingState.Available status");
}
}

Error Codes

Name

Description

PREVIEW_UNAVAILABLE

This error string is passed in the callback if save is called when preview is not available

PERMISSION_UNAVAILABLE

This error is passed in the callback if external storage permissions are not set in ReplayKit Settings inspector (make sure you click on save button after updating the inspector)