captureStillImageBracketAsynchronously(from:withSettingsArray:completionHandler:)
Captures a still image bracket.
Declaration
func captureStillImageBracketAsynchronously(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings], completionHandler handler: @escaping (CMSampleBuffer?, AVCaptureBracketedStillImageSettings?, (any Error)?) -> Void)Parameters
- connection:
The connection through which the still image bracket should be captured.
- settings:
An array of Avcapturebracketedstillimagesettings objects. All the array items must be of the same Avcapturebracketedstillimagesettings subclass, or an Invalidargumentexception exception is thrown.
- handler:
A user provided block that will be called asynchronously as each still image in the bracket is captured.
The block has three parameters:
- sampleBuffer
If the capture request is successful, contains a valid CMSampleBuffer.
- stillImageSettings
Contains the Avcapturebracketedstillimagesettings object corresponding to this still image.
- error
If the bracketed capture fails,
sampleBufferisNULLand error is non-nil.
If the count of the
settingsparameter exceeds Maxbracketedcapturestillimagecount, thenAVErrorMaximumStillImageCaptureRequestsExceededis returned.You should not assume that the completion handler will be called on a specific thread.
Discussion
If you have not invoked prepareToCaptureStillImageBracket(from:withSettingsArray:completionHandler:) for this still image bracket request, the bracket may not be taken immediately, as the receiver may internally need to prepare resources.