SCCameraKitProtocol

Objective-C

@protocol SCCameraKitProtocol <NSObject>

/// Contains lenses related objects.
@property (strong, nonatomic, readonly) id<SCCameraKitLensesComponent> lenses;

/// Begin processing input frames with front camera position and portrait video orientation
/// @param input the input to configure.
/// @param arInput the ARKit input to configure.
- (void)startWithInput:(id<SCCameraKitInput>)input
               arInput:(id<SCCameraKitARInput>)arInput NS_SWIFT_NAME(start(input:arInput:));

/// Deprecated. Use
/// -startWithInput:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:agreementsPresentationContextProvider:
- (void)startWithInput:(id<SCCameraKitInput>)input
               arInput:(id<SCCameraKitARInput>)arInput
        cameraPosition:(AVCaptureDevicePosition)cameraPosition
      videoOrientation:(AVCaptureVideoOrientation)videoOrientation
          dataProvider:(SCCameraKitDataProviderComponent *)dataProvider
          hintDelegate:(id<SCCameraKitLensHintDelegate>)hintDelegate __attribute__((deprecated));

/// Deprecated. Use
/// -startWithInput:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:textInputContextProvider:agreementsPresentationContextProvider:
- (void)startWithInput:(id<SCCameraKitInput>)input
                                  arInput:(id<SCCameraKitARInput>)arInput
                           cameraPosition:(AVCaptureDevicePosition)cameraPosition
                         videoOrientation:(AVCaptureVideoOrientation)videoOrientation
                             dataProvider:(nullable SCCameraKitDataProviderComponent *)dataProvider
                             hintDelegate:(nullable id<SCCameraKitLensHintDelegate>)hintDelegate
    agreementsPresentationContextProvider:
        (nullable id<SCCameraKitAgreementsPresentationContextProvider>)agreementsPresentationContextProvider
    NS_SWIFT_NAME(start(input:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:agreementsPresentationContextProvider:))
        __attribute__((deprecated));
;

/// Begin processing input frames.
/// @param input the input to configure.
/// @param arInput the ARKit input to configure.
/// @param cameraPosition the camera position in use
/// @param videoOrientation the orientation for the outputted video buffers
/// @param dataProvider data provider component to pass in custom data providers (optional -- will create and handle
/// data providers by default if nil)
/// @param hintDelegate lens hint delegate to show/hide hints for applied lenses
/// @param textInputContextProvider context provider for providing keyboard access to lenses
/// @param agreementsPresentationContextProvider context provider for presenting agreements screens
- (void)startWithInput:(id<SCCameraKitInput>)input
                                  arInput:(id<SCCameraKitARInput>)arInput
                           cameraPosition:(AVCaptureDevicePosition)cameraPosition
                         videoOrientation:(AVCaptureVideoOrientation)videoOrientation
                             dataProvider:(nullable SCCameraKitDataProviderComponent *)dataProvider
                             hintDelegate:(nullable id<SCCameraKitLensHintDelegate>)hintDelegate
                 textInputContextProvider:(nullable id<SCCameraKitTextInputContextProvider>)textInputContextProvider
    agreementsPresentationContextProvider:
        (nullable id<SCCameraKitAgreementsPresentationContextProvider>)agreementsPresentationContextProvider
    NS_SWIFT_NAME(start(input:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:textInputContextProvider:agreementsPresentationContextProvider:));

/// End processing input frames.
- (void)stop;

/// End processing input frames.
/// @param completion Block to be called after processing is finished and session is stopped
- (void)stopWithCompletion:(nullable void (^)(void))completion NS_SWIFT_NAME(stop(completion:));

/// Add an output. Frames will still be processed if no outputs exist.
- (void)addOutput:(id<SCCameraKitOutput>)output NS_SWIFT_NAME(add(output:));

/// Remove an output.
- (void)removeOutput:(id<SCCameraKitOutput>)listener NS_SWIFT_NAME(remove(output:));

/// The camera position in use. Setting will automatically update the input.
@property (nonatomic, assign) AVCaptureDevicePosition cameraPosition;

/// The orientation for the outputted video buffers
@property (nonatomic, assign) AVCaptureVideoOrientation videoOrientation;

/// The active input. May be either standard camera input or the AR input, depending on lens requirements.
@property (nonatomic, readonly) id<SCCameraKitInput> activeInput;

/// Store containing information above the acceptance state of terms of service
@property (nonatomic, readonly) id<SCCameraKitAgreementsStore> agreementsStore;

/// Presents any agreements such as Terms of Service or Privacy Policy for CameraKit immediately, if needed.
/// @note CameraKit will present this when the user applies a lens if they have new agreements to accept. You can call
/// this explicitly if you wish to present the terms before then (eg during an onboarding experience, alongside your own
/// app's Terms of Service)
- (void)presentAgreementsImmediately;

@end

Swift

protocol CameraKitProtocol : NSObjectProtocol

Undocumented

  • Contains lenses related objects.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) id<SCCameraKitLensesComponent> _Nonnull lenses;
  • Begin processing input frames with front camera position and portrait video orientation

    Declaration

    Objective-C

    - (void)startWithInput:(nonnull id<SCCameraKitInput>)input
                   arInput:(nonnull id<SCCameraKitARInput>)arInput;

    Parameters

    input

    the input to configure.

    arInput

    the ARKit input to configure.

  • Deprecated

    Deprecated. Use -startWithInput:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:agreementsPresentationContextProvider:

    Declaration

    Objective-C

    - (void)startWithInput:(nonnull id<SCCameraKitInput>)input
                   arInput:(nonnull id<SCCameraKitARInput>)arInput
            cameraPosition:(AVCaptureDevicePosition)cameraPosition
          videoOrientation:(AVCaptureVideoOrientation)videoOrientation
              dataProvider:(nonnull SCCameraKitDataProviderComponent *)dataProvider
              hintDelegate:(nonnull id<SCCameraKitLensHintDelegate>)hintDelegate;
  • Deprecated

    Deprecated. Use -startWithInput:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:textInputContextProvider:agreementsPresentationContextProvider:

    Declaration

    Objective-C

    - (void)startWithInput:(nonnull id<SCCameraKitInput>)input
                                      arInput:
                                          (nonnull id<SCCameraKitARInput>)arInput
                               cameraPosition:
                                   (AVCaptureDevicePosition)cameraPosition
                             videoOrientation:
                                 (AVCaptureVideoOrientation)videoOrientation
                                 dataProvider:
                                     (nullable SCCameraKitDataProviderComponent *)
                                         dataProvider
                                 hintDelegate:
                                     (nullable id<SCCameraKitLensHintDelegate>)
                                         hintDelegate
        agreementsPresentationContextProvider:
            (nullable id<SCCameraKitAgreementsPresentationContextProvider>)
                agreementsPresentationContextProvider;
  • Begin processing input frames.

    Declaration

    Objective-C

    - (void)startWithInput:(nonnull id<SCCameraKitInput>)input
                                      arInput:
                                          (nonnull id<SCCameraKitARInput>)arInput
                               cameraPosition:
                                   (AVCaptureDevicePosition)cameraPosition
                             videoOrientation:
                                 (AVCaptureVideoOrientation)videoOrientation
                                 dataProvider:
                                     (nullable SCCameraKitDataProviderComponent *)
                                         dataProvider
                                 hintDelegate:
                                     (nullable id<SCCameraKitLensHintDelegate>)
                                         hintDelegate
                     textInputContextProvider:
                         (nullable id<SCCameraKitTextInputContextProvider>)
                             textInputContextProvider
        agreementsPresentationContextProvider:
            (nullable id<SCCameraKitAgreementsPresentationContextProvider>)
                agreementsPresentationContextProvider;

    Parameters

    input

    the input to configure.

    arInput

    the ARKit input to configure.

    cameraPosition

    the camera position in use

    videoOrientation

    the orientation for the outputted video buffers

    dataProvider

    data provider component to pass in custom data providers (optional – will create and handle data providers by default if nil)

    hintDelegate

    lens hint delegate to show/hide hints for applied lenses

    textInputContextProvider

    context provider for providing keyboard access to lenses

    agreementsPresentationContextProvider

    context provider for presenting agreements screens

  • End processing input frames.

    Declaration

    Objective-C

    - (void)stop;

    Swift

    func stop()
  • End processing input frames.

    Declaration

    Objective-C

    - (void)stopWithCompletion:(nullable void (^)(void))completion;

    Swift

    func stop() async

    Parameters

    completion

    Block to be called after processing is finished and session is stopped

  • Add an output. Frames will still be processed if no outputs exist.

    Declaration

    Objective-C

    - (void)addOutput:(nonnull id<SCCameraKitOutput>)output;
  • Remove an output.

    Declaration

    Objective-C

    - (void)removeOutput:(nonnull id<SCCameraKitOutput>)listener;
  • The camera position in use. Setting will automatically update the input.

    Declaration

    Objective-C

    @property (nonatomic) AVCaptureDevicePosition cameraPosition;

    Swift

    var cameraPosition: AVCaptureDevice.Position { get set }
  • The orientation for the outputted video buffers

    Declaration

    Objective-C

    @property (nonatomic) AVCaptureVideoOrientation videoOrientation;

    Swift

    var videoOrientation: AVCaptureVideoOrientation { get set }
  • The active input. May be either standard camera input or the AR input, depending on lens requirements.

    Declaration

    Objective-C

    @property (nonatomic, readonly) id<SCCameraKitInput> _Nonnull activeInput;
  • Store containing information above the acceptance state of terms of service

    Declaration

    Objective-C

    @property (nonatomic, readonly) id<SCCameraKitAgreementsStore> _Nonnull agreementsStore;
  • Presents any agreements such as Terms of Service or Privacy Policy for CameraKit immediately, if needed.

    Note

    CameraKit will present this when the user applies a lens if they have new agreements to accept. You can call this explicitly if you wish to present the terms before then (eg during an onboarding experience, alongside your own app’s Terms of Service)

    Declaration

    Objective-C

    - (void)presentAgreementsImmediately;

    Swift

    func presentAgreementsImmediately()