CaptureManager
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
The
AVCaptureVideoOrientationthat corresponds to the current device’s orientation.Declaration
Swift
public var desiredVideoOrientation: AVCaptureVideoOrientation -
The
AVCaptureFlashModeofvideoDeviceDeclaration
Swift
public var flashMode: AVCaptureFlashMode -
The
AVCaptureTorchModeofvideoDeviceDeclaration
Swift
public var torchMode: AVCaptureTorchMode -
Returns the
AVAuthorizationStatusfor themediaTypeofinput.Declaration
Swift
public func authorizationStatus(forInput input: CaptureSessionInput) -> AVAuthorizationStatusParameters
inputThe
CaptureSessionInputto inspect the status of. -
Determines whether or not images taken with front camera are mirrored. Default is
true.Declaration
Swift
public var mirrorsFrontCamera = true
-
Set up the AVCaptureSession.
Important
Recreates inputs/outputs based on
sessionPreset.Throws
CaptureManagerError.invalidSessionPresetifsessionPresetis not valid.Declaration
Swift
public func setUp(sessionPreset: String, previewLayerProvider: VideoPreviewLayerProvider?, inputs: [CaptureSessionInput], outputs: [CaptureSessionOutput], errorHandler: @escaping ErrorCompletionHandler)Parameters
sessionPresetThe
sessionPresetfor theAVCaptureSession.inputsA mask of options of type
CaptureSessionInputsindicating what inputs to add to theAVCaptureSession.outputsA mask of options of type
CaptureSessionOutputsindicating what outputs to add to theAVCaptureSession.errorHandlerA closure of type
(Error) -> Void. Called on the if anything performed inside ofsessionQueuethread throws an error.
-
Start running the
AVCaptureSession.Declaration
Swift
public func startRunning(_ errorHandler: ErrorCompletionHandler? = nil) -
Stop running the
AVCaptureSession.Declaration
Swift
public func stopRunning() -
Capture a still image. - parameter completion: A closure of type
(UIImage?, Error?) -> Voidthat is called on the main thread upon successful capture of the image or the occurence of an error.Declaration
Swift
public func captureStillImage(_ completion: @escaping ImageErrorCompletionHandler)Parameters
completionA closure of type
(UIImage?, Error?) -> Voidthat is called on the upon successful capture of the image or the occurence of an error. -
Start recording a video. - parameter toOutputFileURL: The URL where the video is recorded to. - parameter recordingDelegate: The
AVCaptureFileOutputRecordingDelegateformovieFileOutput. - Throws:CaptureManagerError.missingMovieOutputifmovieFileOutputis nil.Declaration
Swift
public func startRecordingMovie(toOutputFileURL url: URL, recordingDelegate: AVCaptureFileOutputRecordingDelegate) throwsParameters
toOutputFileURLThe URL where the video is recorded to.
recordingDelegateThe
AVCaptureFileOutputRecordingDelegateformovieFileOutput. -
Stop recording a video. - Throws:
CaptureManagerError.missingMovieOutputifmovieFileOutputis nil.Declaration
Swift
public func stopRecordingMovie() throws -
Toggles the position of the camera if possible. - parameter errorHandler: A closure of type
Error -> Voidthat is called on the main thread if no opposite device or input was found.Declaration
Swift
public func toggleCamera(_ errorHandler: @escaping ErrorCompletionHandler)Parameters
errorHandlerA closure of type
Error -> Voidthat is called on the if no opposite device or input was found. -
Sets the
AVCaptureFlashModeforvideoDevice. - parameter mode: TheAVCaptureFlashModeto set. - parameter errorHandler: A closure of typeError -> Voidthat is called on the main thread if an error occurs while setting theAVCaptureFlashMode.Declaration
Swift
public func setFlash(_ mode: AVCaptureFlashMode, errorHandler: ErrorCompletionHandler? = nil) throwsParameters
modeThe
AVCaptureFlashModeto set.errorHandlerA closure of type
Error -> Voidthat is called on the if an error occurs while setting theAVCaptureFlashMode. -
Toggles the
AVCaptureFlashModeforvideoDevice. - Important: If the currentAVCaptureFlashModeis set to.auto, this will set it to.on.Declaration
Swift
public func toggleFlash(errorHandler: ErrorCompletionHandler? = nil) throws -
Sets the
AVCaptureTorchModeforvideoDevice. - parameter mode: TheAVCaptureTorchModeto set. - parameter errorHandler: A closure of typeError -> Voidthat is called on the main thread if an error occurs while setting theAVCaptureTorchMode.Declaration
Swift
public func setTorch(_ mode: AVCaptureTorchMode, errorHandler: ErrorCompletionHandler? = nil) throwsParameters
modeThe
AVCaptureTorchModeto set.errorHandlerA closure of type
Error -> Voidthat is called on the if an error occurs while setting theAVCaptureTorchMode. -
Toggles the
AVCaptureTorchModeforvideoDevice. - Important: If the currentAVCaptureTorchModeis set to.auto, this will set it to.on.Declaration
Swift
public func toggleTorch(errorHandler: ErrorCompletionHandler? = nil) throws -
Focuses the camera at
pointInView. - parameter pointInView: The point inside of theAVCaptureVideoPreviewLayer. - parameter errorHandler: A closure of typeError -> Voidthat is called on the main thread if no device or previewLayerProvider was found or if we failed to lock the device for configuration. - Important: Do not normalize! This method handles the normalization for you. Simply pass in the point relative to the preview layer’s coordinate system.Declaration
Swift
public func focusAndExposure(at pointInView: CGPoint, errorHandler: ErrorCompletionHandler? = nil) throwsParameters
pointInViewThe point inside of the
AVCaptureVideoPreviewLayer.errorHandlerA closure of type
Error -> Voidthat is called on the if no device or previewLayerProvider was found or if we failed to lock the device for configuration.
-
Undocumented
-
Asynchronously refreshes the videoOrientation of the
AVCaptureVideoPreviewLayer.Declaration
Swift
public func refreshOrientation()
CaptureManager Class Reference