Type Alias

AVAssetImageGeneratorCompletionHandler

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

Declaration

typedef void (^AVAssetImageGeneratorCompletionHandler)(CMTime requestedTime, CGImageRef image, CMTime actualTime, AVAssetImageGeneratorResult result, NSError *error);

Discussion

Pass a block of this type to generateCGImagesAsynchronouslyForTimes: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 AVAssetImageGeneratorFailed, an error object that describes the problem.

See Also

Generating Images

- copyCGImageAtTime:actualTime:error:

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

- generateCGImagesAsynchronouslyForTimes:completionHandler:

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

AVAssetImageGeneratorResult

The statuses indicating the outcome of image generation.

- cancelAllCGImageGeneration

Cancels all pending image generation requests.