Instance Method

exportAsynchronously(completionHandler:)

Starts the asynchronous execution of an export session.

Declaration

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

Parameters

handler

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

Discussion

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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software