ARGear SDK Documentations
  • Introduction
  • Android
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Overview
    • 4. ARGSession
    • 5. Camera
    • 6. Rendering
    • 7. CMS Service
    • 8. Download Contents
    • 9. Set Contents
    • 10. Media
    • 11. Switch Camera Face
    • 12. Enable Debugging Mode
    • 13. ARCore Connect API
    • 14. API Reference
  • iOS
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Overview
    • 4. ARGSession
    • 5. Camera
    • 6. Rendering
    • 7. CMS Service
    • 8. Download Contents
    • 9. Set Contents
    • 10. Media
    • 11. Switch Camera Face
    • 12. Enable Debugging Mode
    • 13. ARKit Connect API
    • 14. API Reference
  • Unity
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Plugin Overview
    • 4. ARGearManager
    • 5. ARGearCamera
    • 6. CMS Service
    • 7. Download Contents
    • 8. Set Contents
    • 9. Switch Camera Face
    • 10. Enable Debugging Mode
    • 11. API Reference
Powered by GitBook
On this page
  • 4.1 Init & Create
  • 4.2 Run
  • 4.3 Pause
  • 4.4 Destroy

Was this helpful?

  1. iOS

4. ARGSession

ARGSession maintains the status of your application and manages the life cycle of your application according to the status. It also contains rendered frames.

Previous3. ARGear OverviewNext5. Camera

Last updated 4 years ago

Was this helpful?

<ARGear/ARGear.h> should be imported beforehand.

ARGSessionDelegate protocol required.

4.1 Init & Create

When creating ARGSession, you can pass ARGConfig and ARGInferenceFeature parameters. ARGConfig contains API URL, API key, secret key, and auth key and it must be sent to ARGSession.

You must pass ARGInferenceFeature parameter to ARGSession and the selected feature will be obtained. The configured feature information can be obtained from ARGFrame.

Below is the sample code to create ARGSession.

// Sample Code. ARGSession Creation Example

ARGConfig *argConfig = [[ARGConfig alloc] initWithApiURL:API_HOST apiKey:API_KEY secretKey:API_SECRET_KEY authKey:API_AUTH_KEY];

NSError * error;
_argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];
_argSession.delegate = self;​
// Sample Code. ARGSession Creation Example

do {
    let config = ARGConfig(
        apiURL: API_HOST,
        apiKey: API_KEY,
        secretKey: API_SECRET_KEY,
        authKey: API_AUTH_KEY
    )
    argSession = try ARGSession(argConfig: config, feature: [.faceMeshTracking])
    argSession?.delegate = self
} catch let error as NSError {
} catch let exception as NSException {
}

Unless ARGConfig is properly set during ARGSession creation, the ARGear SDK will not be initiated. Therefore, you must create an account in , set the created API Key information in ARGConfig, and create ARGSession with the ARGConfig to use ARGear SDK.

4.2 Run

Sample code is written below.

// Sample Code. ARGSession Run Example

ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig feature:ARGInferenceFeatureFaceMeshTracking error:&error];
 
[argSession run];
// Sample Code. ARGSession Run Example

argSession = try ARGSession(argConfig: config, feature: [.faceLowTracking])

argSession?.run()

4.3 Pause

To pause the current ARGSession, call pause function inside ARGSession.

Sample code is written below.

// Sample Code. ARGSession Pause Example

ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];
 
[argSession pause];
// Sample Code. ARGSession Pause Example

argSession?.pause()

4.4 Destroy

To destroy the current ARGSession, use the destroy function.

Sample code is written as follows.

// Sample Code. ARGSession Destroy Example

ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];
 
[argSession destroy];
// Sample Code. ARGSession Destroy Example

argSession?.destroy()

Create ARGSession with or without an option, ARGInferenceOption. For the details of ARGInferenceOption, please refer to .

https://argear.io
ARGInferenceOption