Instance Method


Creates a series of image objects for an asset at or near specified times.


func generateCGImagesAsynchronously(forTimes requestedTimes: [NSValue], completionHandler handler: @escaping AVAssetImageGeneratorCompletionHandler)



An array of NSValue objects, each containing a CMTime, specifying the asset times at which an image is requested.


A block called when an image request is complete.


This method uses an efficient “batch mode” to get images in time order.

The client receives exactly one handler callback for each requested time in requestedTimes. Changes to the generator’s properties (snap behavior, maximum size, and so on) do not affect pending asynchronous image generation requests.

See Also

Generating Images

func copyCGImage(at: CMTime, actualTime: UnsafeMutablePointer<CMTime>?) -> CGImage

Returns an image for the asset at or near a specified time.

typealias AVAssetImageGeneratorCompletionHandler

A block that you use to receive thumbnail images generated from an asset.

enum AVAssetImageGenerator.Result

The statuses indicating the outcome of image generation.

func cancelAllCGImageGeneration()

Cancels all pending image generation requests.