GSKCameraSessionDelegate

Objective-C

@protocol GSKCameraSessionDelegate <NSObject>

Swift

protocol GSKCameraSessionDelegate : NSObjectProtocol

The delegate of GSKCameraSession must adopt the GSKCameraSessionDelegate protocol.

This protocol gives information about the state of the camera session, from configuration to snapping of photos.

There is no guarantee that these callbacks will be called on the main thread.

  • The camera session setup finished with an error

    Declaration

    Objective-C

    - (void)cameraSession:(nonnull GSKCameraSession *)cameraSession
        setupFailedWithError:(nonnull NSError *)error;

    Swift

    func cameraSession(_ cameraSession: GSKCameraSession, setupFailedWithError error: Error)

    Parameters

    cameraSession

    The camera session

    error

    The error that prevented setup

  • The camera session encountered a non-fatal error

    Declaration

    Objective-C

    - (void)cameraSession:(nonnull GSKCameraSession *)cameraSession
        didEncounterFailureWithError:(nonnull NSError *)error;

    Swift

    func cameraSession(_ cameraSession: GSKCameraSession, didEncounterFailureWithError error: Error)

    Parameters

    cameraSession

    The camera session.

    error

    The encountered error.

  • Camera session is going to take the photo

    Declaration

    Objective-C

    - (void)cameraSessionWillSnapPhoto:(nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionWillSnapPhoto(_ cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session

  • Camera session just took picture but we haven’t post-processed it yet

    Declaration

    Objective-C

    - (void)cameraSessionDidSnapPhoto:(nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionDidSnapPhoto(_ cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session

  • The camera session couldn’t snap a photo

    Declaration

    Objective-C

    - (void)cameraSession:(nonnull GSKCameraSession *)cameraSession
        didFailToSnapPhotoWithError:(nonnull NSError *)error;

    Swift

    func cameraSession(_ cameraSession: GSKCameraSession, didFailToSnapPhotoWithError error: Error)

    Parameters

    cameraSession

    The camera session

    error

    The error that prevented the photo from being taken.

  • Camera session has finished processing the photo we just took

    Declaration

    Objective-C

    - (void)cameraSession:(nonnull GSKCameraSession *)cameraSession
          didGenerateScan:(nonnull GSKScan *)scan;

    Swift

    func cameraSession(_ cameraSession: GSKCameraSession, didGenerate scan: GSKScan)

    Parameters

    cameraSession

    The camera session

    scan

    The scan object that has been generated. The files will be stored in the directory defined by the GSKCameraSessionOutputConfiguration.

  • THe camera session failed with an error.

    Declaration

    Objective-C

    - (void)cameraSession:(nonnull GSKCameraSession *)cameraSession
         didFailWithError:(nonnull NSError *)error;

    Swift

    func cameraSession(_ cameraSession: GSKCameraSession, didFailWithError error: Error)

    Parameters

    cameraSession

    The camera session

    error

    The encountered error.

  • The camera session setup finished successfully.

    This is your chance to hook up into the setup to change some params on the AVCaptureSession.

    This callback is called on a specific queue where all the session calls are serialized.

    Declaration

    Objective-C

    - (void)cameraSessionDidSetup:(nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionDidSetup(_ cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session

  • The camera session is still looking for a quadrangle.

    This is a general notification about the status of the search: we may or may not have identified its edges. If you want to act on identified edges, listen to the cameraSession:didFindQuadrangle: delegate method.

    Declaration

    Objective-C

    - (void)cameraSessionIsSearchingQuadrangle:
        (nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionIsSearchingQuadrangle(_ cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session

  • The camera session identified a quadrangle in last frame of photo stream

    Declaration

    Objective-C

    - (void)cameraSession:(nonnull GSKCameraSession *)cameraSession
        didFindQuadrangle:(nonnull GSKQuadrangle *)quadrangle;

    Swift

    func cameraSession(_ cameraSession: GSKCameraSession, didFind quadrangle: GSKQuadrangle)

    Parameters

    cameraSession

    The camera session

    quadrangle

    The quadrangle that has been found.

  • The camera session couldn’t identify quadrangle in last frame of photo stream

    Declaration

    Objective-C

    - (void)cameraSessionFailedToFindQuadrangle:
        (nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionFailed(toFindQuadrangle cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session

  • The camera session real-time quadrangle detection will soon validate the quadrangle.

    It’s a good time to tell the user to remain stable.

    Declaration

    Objective-C

    - (void)cameraSessionIsAboutToChooseQuadrangle:
        (nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionIsAbout(toChooseQuadrangle cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session

  • The camera session is going to automatically take the photo

    This callback is called immediately before snapping the photo.

    Declaration

    Objective-C

    - (void)cameraSession:(nonnull GSKCameraSession *)cameraSession
        willAutoTriggerWithQuadrangle:(nonnull GSKQuadrangle *)quadrangle;

    Swift

    func cameraSession(_ cameraSession: GSKCameraSession, willAutoTriggerWith quadrangle: GSKQuadrangle)

    Parameters

    cameraSession

    The camera session

    quadrangle

    The selected quadrangle

  • Camera session started running

    Declaration

    Objective-C

    - (void)cameraSessionDidStart:(nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionDidStart(_ cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session

  • Camera session stopped running

    Declaration

    Objective-C

    - (void)cameraSessionDidStop:(nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionDidStop(_ cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session

  • Camera session was interrupted.

    This can happen in various cases, including when the user goes to Split View mode

    Declaration

    Objective-C

    - (void)cameraSession:(nonnull GSKCameraSession *)cameraSession
        wasInterruptedWithReason:(AVCaptureSessionInterruptionReason)reason;

    Swift

    func cameraSession(_ cameraSession: GSKCameraSession, wasInterruptedWith reason: AVCaptureSession.InterruptionReason)

    Parameters

    cameraSession

    The camera session

    reason

    The reason why the camera session was interrupted.

  • Camera session resumes after interruption

    Declaration

    Objective-C

    - (void)cameraSessionInterruptionEnded:
        (nonnull GSKCameraSession *)cameraSession;

    Swift

    func cameraSessionInterruptionEnded(_ cameraSession: GSKCameraSession)

    Parameters

    cameraSession

    The camera session