RRCaptureSession

Objective-C

@interface RRCaptureSession : NSObject

Swift

class RRCaptureSession : NSObject

The RRCaptureSession class manages capturing of Full Body Avatar. In a nutshell it allows you to create any amount of circular stages as well as to perform additional stage after all. It is listening to device accelerometer updates and detects whether or not it should capture a photo on any specific angle.

There are few main functions that will help you to control the flow, there is also an ability to subscribe to the list of capturing events

Warning

use freeSession when you done to avoid memory issues
  • The product type specifies the kind of product. For example garments and furniture are two different product types

    Declaration

    Objective-C

    @property (nonatomic) NSInteger productType;

    Swift

    var productType: Int { get set }
  • Current parameters for the session

    Declaration

    Objective-C

    @property (nonatomic, readonly) RRCaptureSessionParameters parameters;

    Swift

    var parameters: Int32 { get }
  • Capture camera device used for capturing

    Declaration

    Objective-C

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

    Swift

    var captureDevice: RRCaptureCameraDevice { get }
  • A place where all the session data is stored

    Declaration

    Objective-C

    @property (nonatomic, readonly) RRCapturePhotos *_Nonnull photos;

    Swift

    var photos: RRCapturePhotos { get }
  • Indicates if all the stages are passed

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL capturingSessionFinished;

    Swift

    var capturingSessionFinished: Bool { get }
  • Returns the current stage index

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger currentStage;

    Swift

    var currentStage: UInt { get }
  • The whole session duration

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSTimeInterval duration;

    Swift

    var duration: TimeInterval { get }
  • Implement capturingPoseDetection() method in your scope which should return pre-inited RRPoseDetection entity

    Declaration

    Objective-C

    @property (nonatomic) id<RRPoseDetectionDelegate> _Nullable poseDetectionDelegate;

    Swift

    unowned(unsafe) var poseDetectionDelegate: RRPoseDetectionDelegate? { get set }
  • Allows to run and play the next stage in queue additional stage goes always at the very end. You can skip it by setting corresponding flag in RRCaptureSessionParameters on session constructor

    Declaration

    Objective-C

    - (void)performStage;

    Swift

    func performStage()
  • Allows to abort currently running section and go to next one, without losing any progress. Mostly used to finish additional stage

    Declaration

    Objective-C

    - (void)finishStage;

    Swift

    func finishStage()
  • Allow you to reset all progress for the previous stage, for example due to bad quality or any other user reason, saying go step back and replay stage again by performStage

    Declaration

    Objective-C

    - (void)resetStage;

    Swift

    func resetStage()
  • Safe way to finish all the process, stop accelerometer updates, finish camera session, free all listeners and release capture data from memory

    Declaration

    Objective-C

    - (void)freeSession;

    Swift

    func freeSession()
  • Initializes an RRCaptureSession object with the parameters. RRCaptureSessionParameters is basically a struct with three paramters stagesAmount, photosPerStage, hasAdditionalStage

    Warning

    call -freeSession() when you done to avoid memory issues

    Declaration

    Objective-C

    - (instancetype _Nonnull)initWithParameters:
        (RRCaptureSessionParameters)parameters;

    Swift

    init(parameters: Any!)

    Parameters

    parameters

    RRCaptureSessionParameters too describe number of rounds and

  • Handle all events while capturing

    Declaration

    Objective-C

    - (void)listenEvents:(RRSessionEventHandler _Nonnull)eventHandler;

    Swift

    func listenEvents(_ eventHandler: @escaping RRSessionEventHandler)

    Parameters

    eventHandler

    RRSessionEventHandler block which is called when any of the following event are happening: StageComplete, CapturePhoto, Rotation, PoseDetection, TooFastVelocity