GSKCameraSession

@interface GSKCameraSession : NSObject

The GSKCameraSession class manages the interactions with the device camera.

  • Declaration

    Objective-C

    - (nonnull instancetype)initWithOutputConfiguration:
        (nonnull GSKCameraSessionOutputConfiguration *)outputConfiguration;

    Swift

    init(outputConfiguration: GSKCameraSessionOutputConfiguration)

    Parameters

    outputConfiguration

    The configuration for the camera session

  • Controls when the video session starts and stops delivering photos

    Declaration

    Objective-C

    - (void)startSessionOnComplete:(nonnull void (^)(void))onComplete;

    Swift

    func start(onComplete: @escaping () -> Void)
  • Sets focus point.

    Declaration

    Objective-C

    - (void)focusAtPoint:(CGPoint)focusPoint;

    Swift

    func focus(at focusPoint: CGPoint)
  • Change the flash status

    Declaration

    Objective-C

    - (void)setFlashStatus:(GSKCameraSessionFlashStatus)flashStatus
                 onSuccess:
                     (nonnull void (^)(GSKCameraSessionFlashStatus))successBlock
                     error:(nonnull void (^)(NSError *_Nullable))errorBlock;

    Swift

    func setFlashStatus(_ flashStatus: GSKCameraSessionFlashStatus, onSuccess successBlock: @escaping (GSKCameraSessionFlashStatus) -> Void, error errorBlock: @escaping (Error?) -> Void)

    Parameters

    flashStatus

    The new status for the flash

    successBlock

    The block called on success

    errorBlock

    The block called on error

  • Manually take a photo

    If autoTriggerEnabled is YES, the photo is taken automatically when the frame is detected. Otherwise, if you want to let the user manually trigger the photo, you can use this method.

    This method can be called even when autoTriggerEnabled and will force taking the photo.

    Declaration

    Objective-C

    - (void)takePhoto;

    Swift

    func takePhoto()
  • True for the duration of taking the photo and processing it. Observable.

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isTakingPhoto) BOOL takingPhoto;

    Swift

    var isTakingPhoto: Bool { get }
  • Camera won’t be used anymore in this session. Makes sure everything can be deallocated successfully.

    Declaration

    Objective-C

    - (void)cleanup;

    Swift

    func cleanup()
  • The camera session delegate.

    See

    GSKCameraSessionDelegate

    Declaration

    Objective-C

    @property (nonatomic, weak, readwrite, nullable) id<GSKCameraSessionDelegate>
        delegate;

    Swift

    weak var delegate: GSKCameraSessionDelegate? { get set }