AVCaptureDevice

class AVCaptureDevice : NSObject
  • Returns the capture device for the desired device type and position.

    protip, NextLevelDevicePosition.avfoundationType can provide the AVFoundation type.

  • Parameters:

    • deviceType: Specified capture device type, (i.e. builtInMicrophone, builtInWideAngleCamera, etc.)
    • position: Desired position of device
  • Returns

    Capture device for the specified type and position, otherwise nil

    Declaration

    Swift

    public class func captureDevice(withType deviceType: AVCaptureDevice.DeviceType, forPosition position: AVCaptureDevice.Position) -> AVCaptureDevice?
  • Returns the default wide angle video device for the desired position, otherwise nil.

    Parameter

    Parameter position: Desired position of the device

    Returns

    Wide angle video capture device, otherwise nil

    Declaration

    Swift

    public class func wideAngleVideoDevice(forPosition position: AVCaptureDevice.Position) -> AVCaptureDevice?
  • Returns the default telephoto video device for the desired position, otherwise nil.

    Parameter

    Parameter position: Desired position of the device

    Returns

    Telephoto video capture device, otherwise nil

    Declaration

    Swift

    public class func telephotoVideoDevice(forPosition position: AVCaptureDevice.Position) -> AVCaptureDevice?
  • Returns the primary duo camera video device, if available, else the default wide angel camera, otherwise nil.

    Parameter

    Parameter position: Desired position of the device

    Returns

    Primary video capture device found, otherwise nil

    Declaration

    Swift

    public class func primaryVideoDevice(forPosition position: AVCaptureDevice.Position) -> AVCaptureDevice?
  • Returns the default video capture device, otherwise nil.

    Returns

    Default video capture device, otherwise nil

    Declaration

    Swift

    public class func videoDevice() -> AVCaptureDevice?
  • Returns the default audio capture device, otherwise nil.

    Returns

    default audio capture device, otherwise nil

    Declaration

    Swift

    public class func audioDevice() -> AVCaptureDevice?
  • Returns the maximum capable framerate for the desired capture format and minimum, otherwise zero.

  • Parameters:

    • format: Capture format to evaluate for a specific framerate.
    • minFrameRate: Lower bound time scale or minimum desired framerate.
  • Returns

    Maximum capable framerate within the desired format and minimum constraints.

    Declaration

    Swift

    public class func maxFrameRate(forFormat format: AVCaptureDevice.Format, minFrameRate: CMTimeScale) -> CMTimeScale
  • Checks if the specified capture device format supports a desired framerate and dimensions.

  • Parameters:

    • frameRate: Desired frame rate
    • dimensions: Desired video dimensions
  • Returns

    true if the capture device format supports the given criteria, otherwise false

    Declaration

    Swift

    public func isSupported(withFrameRate frameRate: CMTimeScale, dimensions: CMVideoDimensions = CMVideoDimensions(width: 0, height: 0)) -> Bool