CaptureManager
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
The
AVCaptureVideoOrientation
that corresponds to the current device’s orientation.Declaration
Swift
public var desiredVideoOrientation: AVCaptureVideoOrientation
-
The
AVCaptureFlashMode
ofvideoDevice
Declaration
Swift
public var flashMode: AVCaptureFlashMode
-
The
AVCaptureTorchMode
ofvideoDevice
Declaration
Swift
public var torchMode: AVCaptureTorchMode
-
Returns the
AVAuthorizationStatus
for themediaType
ofinput
.Declaration
Swift
public func authorizationStatus(forInput input: CaptureSessionInput) -> AVAuthorizationStatus
Parameters
input
The
CaptureSessionInput
to 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.invalidSessionPreset
ifsessionPreset
is not valid.Declaration
Swift
public func setUp(sessionPreset: String, previewLayerProvider: VideoPreviewLayerProvider?, inputs: [CaptureSessionInput], outputs: [CaptureSessionOutput], errorHandler: @escaping ErrorCompletionHandler)
Parameters
sessionPreset
The
sessionPreset
for theAVCaptureSession
.inputs
A mask of options of type
CaptureSessionInputs
indicating what inputs to add to theAVCaptureSession
.outputs
A mask of options of type
CaptureSessionOutputs
indicating what outputs to add to theAVCaptureSession
.errorHandler
A closure of type
(Error) -> Void
. Called on the if anything performed inside ofsessionQueue
thread 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?) -> Void
that 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
completion
A closure of type
(UIImage?, Error?) -> Void
that 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
AVCaptureFileOutputRecordingDelegate
formovieFileOutput
. - Throws:CaptureManagerError.missingMovieOutput
ifmovieFileOutput
is nil.Declaration
Swift
public func startRecordingMovie(toOutputFileURL url: URL, recordingDelegate: AVCaptureFileOutputRecordingDelegate) throws
Parameters
toOutputFileURL
The URL where the video is recorded to.
recordingDelegate
The
AVCaptureFileOutputRecordingDelegate
formovieFileOutput
. -
Stop recording a video. - Throws:
CaptureManagerError.missingMovieOutput
ifmovieFileOutput
is nil.Declaration
Swift
public func stopRecordingMovie() throws
-
Toggles the position of the camera if possible. - parameter errorHandler: A closure of type
Error -> Void
that is called on the main thread if no opposite device or input was found.Declaration
Swift
public func toggleCamera(_ errorHandler: @escaping ErrorCompletionHandler)
Parameters
errorHandler
A closure of type
Error -> Void
that is called on the if no opposite device or input was found. -
Sets the
AVCaptureFlashMode
forvideoDevice
. - parameter mode: TheAVCaptureFlashMode
to set. - parameter errorHandler: A closure of typeError -> Void
that is called on the main thread if an error occurs while setting theAVCaptureFlashMode
.Declaration
Swift
public func setFlash(_ mode: AVCaptureFlashMode, errorHandler: ErrorCompletionHandler? = nil) throws
Parameters
mode
The
AVCaptureFlashMode
to set.errorHandler
A closure of type
Error -> Void
that is called on the if an error occurs while setting theAVCaptureFlashMode
. -
Toggles the
AVCaptureFlashMode
forvideoDevice
. - Important: If the currentAVCaptureFlashMode
is set to.auto
, this will set it to.on
.Declaration
Swift
public func toggleFlash(errorHandler: ErrorCompletionHandler? = nil) throws
-
Sets the
AVCaptureTorchMode
forvideoDevice
. - parameter mode: TheAVCaptureTorchMode
to set. - parameter errorHandler: A closure of typeError -> Void
that is called on the main thread if an error occurs while setting theAVCaptureTorchMode
.Declaration
Swift
public func setTorch(_ mode: AVCaptureTorchMode, errorHandler: ErrorCompletionHandler? = nil) throws
Parameters
mode
The
AVCaptureTorchMode
to set.errorHandler
A closure of type
Error -> Void
that is called on the if an error occurs while setting theAVCaptureTorchMode
. -
Toggles the
AVCaptureTorchMode
forvideoDevice
. - Important: If the currentAVCaptureTorchMode
is 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 -> Void
that 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) throws
Parameters
pointInView
The point inside of the
AVCaptureVideoPreviewLayer
.errorHandler
A closure of type
Error -> Void
that 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()