Instance Method


Requests an export session for writing the video asset’s data to a file, to be loaded asynchronously.


func requestExportSession(forVideo asset: PHAsset, options: PHVideoRequestOptions?, exportPreset: String, resultHandler: @escaping (AVAssetExportSession?, [AnyHashable : Any]?) -> Void) -> PHImageRequestID



The video asset for which an export session is to be created.


Options specifying how Photos should handle the request and notify your app of progress or errors. For details, see PHVideoRequestOptions.


The export preset name for exporting the asset. For available presets, see AVAssetExportSession.


A block that Photos calls after loading the asset’s data and preparing the export session.

The block takes the following parameters:


An AVAssetExportSession object that you can use for writing the video asset’s data to a file.


A dictionary that provides information about the status of the request. See Image Result Info Keys for possible keys and values.

Return Value

A numeric identifier for the request. If you need to cancel the request before it completes, pass this identifier to the cancelImageRequest(_:) method.


When you call this method, Photos downloads the video data (if necessary) and creates an export session. It then calls your resultHandler block to provide the requested video.

For additional export options, use the requestAVAsset(forVideo:options:resultHandler:) method and then create AVAssetReader and AVAssetWriter objects to transcode and output the video asset’s data.

See Also

Requesting Video Objects