Type Alias

AVAssetImageGeneratorCompletionHandler

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

Declaration

typealias AVAssetImageGeneratorCompletionHandler = (CMTime, CGImage?, CMTime, AVAssetImageGenerator.Result, Error?) -> Void

Discussion

Pass a block of this type to generateCGImagesAsynchronously(forTimes:completionHandler:), and use that block to receive the generated images. The generateCGImagesAsynchronously(forTimes:completionHandler:) method executes this handler once for each time value you specified.

The block takes five arguments:

requestedTime

The time for which you requested an image.

image

The image that was generated, or NULL if the image could not be generated.

This parameter follows The Get Rule.

actualTime

The time at which the image was actually generated.

result

A result code indicating whether the image generation process succeeded, failed, or was cancelled.

error

If result is AVAssetImageGenerator.Result.failed, an error object that describes the problem.

See Also

Generating Images

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

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

enum AVAssetImageGenerator.Result

The statuses indicating the outcome of image generation.

func cancelAllCGImageGeneration()

Cancels all pending image generation requests.