Instance Method


Starts the asynchronous execution of an export session.


func exportAsynchronously(completionHandler handler: @escaping () -> Void)



A block that is invoked when writing is complete or in the event of writing failure.


This method starts an asynchronous export operation and returns immediately. status signals the terminal state of the export session, and if a failure occurs, error describes the problem.

If internal preparation for export fails, handler is invoked synchronously. The handler may also be called asynchronously, after the method returns, in the following cases:

  1. If a failure occurs during the export, including failures of loading, re-encoding, or writing media data to the output.

  2. If cancelExport() is invoked.

  3. After the export session succeeds, having completely written its output to the outputURL.

See Also

Exporting Media

func cancelExport()

Cancels the execution of an export session.

var error: Error?

Describes the error that occurred.

enum AVAssetExportSession.Status

A set of statuses used for relaying the state of an export session.

var estimatedOutputFileLength: Int64

The estimated size, in bytes, of the exported file.

var maxDuration: CMTime

Provides an estimate of the maximum duration of the exported media.