Camera

Objective-C

@interface Camera : NSObject <ZoomDelegate, TorchDelegate>

Swift

class Camera : NSObject, ZoomDelegate, TorchDelegate

A utility object to create and control the camera

  • An object that manages capture activity and coordinates the flow of data from input devices to capture outputs

    Declaration

    Objective-C

    @property (nonatomic, readonly) AVCaptureSession *_Nonnull captureSession;

    Swift

    var captureSession: AVCaptureSession { get }
  • Device that provides input (such as audio or video) for capture sessions and offers controls for hardware-specific capture features.

    Declaration

    Objective-C

    @property (nonatomic, readonly) AVCaptureDevice *_Nonnull captureDevice;

    Swift

    var captureDevice: AVCaptureDevice { get }
  • Capture dimensions for the camera

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGSize captureDimensions;

    Swift

    var captureDimensions: CGSize { get }
  • A capture output that records video and provides access to video frames for processing.

    Declaration

    Objective-C

    @property (nonatomic, readonly) AVCaptureVideoDataOutput *_Nonnull defaultVideoDataOutput;

    Swift

    var defaultVideoDataOutput: AVCaptureVideoDataOutput { get }
  • To control the flash light power ratio

    Declaration

    Objective-C

    @property double torchPowerRatio;

    Swift

    var torchPowerRatio: Double { get set }
  • To intialise the camera object with device type and formate

    Declaration

    Objective-C

    - (nonnull instancetype)initWithType:(nonnull AVCaptureDeviceType)type
                               andFormat:(nullable AVCaptureDeviceFormat *)format;

    Swift

    init(type: AVCaptureDevice.DeviceType, andFormat format: AVCaptureDevice.Format?)

    Parameters

    type

    a device type for the camera

    format

    formate of the capture device

  • To start the camera frame processing

    Declaration

    Objective-C

    - (void)startFrameCapturing;

    Swift

    func startFrameCapturing()
  • To stop the camera frame processing

    Declaration

    Objective-C

    - (void)stopFrameCapturing;

    Swift

    func stopFrameCapturing()
  • To release the camera from memory

    Declaration

    Objective-C

    - (void)release_;

    Swift

    func release_()
  • To control the status of the flash light

    Declaration

    Objective-C

    - (BOOL)turnTorchOnOff:(BOOL)onOff;

    Swift

    func turnTorch(onOff: Bool) -> Bool

    Parameters

    onOff

    a boolean to control the flash light turning on or off