AVCaptureDevice

extension AVCaptureDevice

Device Lookup

  • Returns the capture device for the desired device type and position.

    protip, AVCaptureDevice.Position.avfoundationType can provide the AVFoundation type.

    Declaration

    Swift

    public class func captureDevice(withType deviceType: AVCaptureDevice.DeviceType, forPosition position: AVCaptureDevice.Position) -> AVCaptureDevice?

    Parameters

    deviceType

    Specified capture device type, (i.e. builtInMicrophone, builtInWideAngleCamera, etc.)

    position

    Desired position of device

    Return Value

    Capture device for the specified type and position, otherwise nil

  • Returns the default wide angle video device for the desired position, otherwise nil.

    Declaration

    Swift

    public class func wideAngleVideoDevice(forPosition position: AVCaptureDevice.Position) -> AVCaptureDevice?

    Parameters

    position

    Desired position of the device

    Return Value

    Wide angle video capture device, otherwise nil

  • Returns the default telephoto video device for the desired position, otherwise nil.

    Declaration

    Swift

    public class func telephotoVideoDevice(forPosition position: AVCaptureDevice.Position) -> AVCaptureDevice?

    Parameters

    position

    Desired position of the device

    Return Value

    Telephoto video capture device, otherwise nil

  • Returns the primary duo camera video device, if available, else the default wide angel camera, otherwise nil.

    Declaration

    Swift

    public class func primaryVideoDevice(forPosition position: AVCaptureDevice.Position) -> AVCaptureDevice?

    Parameters

    position

    Desired position of the device

    Return Value

    Primary video capture device found, otherwise nil

  • Returns the default video capture device, otherwise nil.

    Declaration

    Swift

    public class func videoDevice() -> AVCaptureDevice?

    Return Value

    Default video capture device, otherwise nil

  • Returns the default audio capture device, otherwise nil.

    Declaration

    Swift

    public class func audioDevice() -> AVCaptureDevice?

    Return Value

    default audio capture device, otherwise nil

Utilities

  • Calculates focal length and principle point camera intrinsic parameters for OpenCV. (see Hartley’s Mutiple View Geometry, Chapter 6)

    Declaration

    Swift

    public func focalLengthAndPrinciplePoint(focalLengthX: inout Float, focalLengthY: inout Float, principlePointX: inout Float, principlePointY: inout Float)

    Parameters

    focalLengthX

    focal length along the x-axis

    focalLengthY

    focal length along the y-axis

    principlePointX

    principle point x-coordinate

    principlePointY

    principle point y-coordinate

    Return Value

    true when the focal length and principle point parameters are successfully calculated.

  • Declaration

    Swift

    extension AVCaptureDevice.Position