Proctor SDK

Updated

This page provides the API reference for the Agora Proctor SDK.

This Swift API reference covers the Agora Proctor SDK APIs for launching and managing Flexible Classroom proctoring scenarios on iOS.

AgoraProctorSDK

AgoraProctorSDK is the basic interface of the Agora Proctor SDK and provides the main methods for a flexible classroom in proctoring scenarios.

init

- (instancetype)init:(AgoraProctorLaunchConfig *)config
            delegate:(id<AgoraProctorSDKDelegate> _Nullable)delegate;

Initializes the AgoraProctorSDK instance.

Parameters

ParameterDescription
configConfiguration for a flexible classroom. See AgoraProctorLaunchConfig.
delegate(Optional) The event handler for the Agora Proctor SDK. See AgoraProctorSDKDelegate.

launch

- (void)launch:(void (^)(void))success
       failure:(void (^)(NSError *))failure;

Launches a flexible classroom in a proctoring scenario.

Parameters

ParameterDescription
successThe callback triggered by a successful launch.
failureThe callback triggered by a failed launch, which returns an error.

version

- (NSString *)version;

Gets the SDK version.

Returns

The SDK version.

AgoraProctorSDKDelegate

AgoraProctorSDKDelegate reports events related to SDK status to your app.

didExit

- (void)proctorSDK:(AgoraProctorSDK *)proctor
           didExit:(AgoraProctorExitReason)reason;

This callback is triggered when a user exits or is kicked from the room.

ParameterDescription
reasonThe reason for the exit. See AgoraProctorExitReason.

Objects

AgoraProctorLaunchConfig

@interface AgoraProctorLaunchConfig : NSObject

@property (nonatomic, copy) NSString *userName;
@property (nonatomic, copy) NSString *userUuid;
@property (nonatomic, assign) AgoraProctorUserRole userRole;
@property (nonatomic, copy) NSString *roomName;
@property (nonatomic, copy) NSString *roomUuid;
@property (nonatomic, copy) NSString *appId;
@property (nonatomic, copy) NSString *token;
@property (nonatomic, assign) AgoraProctorRegion region;
@property (nonatomic, strong, nullable) AgoraProctorMediaOptions *mediaOptions;
@property (nonatomic, copy, nullable) NSDictionary<NSString *, id> *userProperties;
@property (nonatomic, strong) NSDictionary<NSString *, AgoraWidgetConfig *> *widgets;

- (instancetype)initWithUserName:(NSString *)userName
                        userUuid:(NSString *)userUuid
                        userRole:(AgoraProctorUserRole)userRole
                        roomName:(NSString *)roomName
                        roomUuid:(NSString *)roomUuid
                           appId:(NSString *)appId
                           token:(NSString *)token;

- (instancetype)initWithUserName:(NSString *)userName
                        userUuid:(NSString *)userUuid
                        userRole:(AgoraProctorUserRole)userRole
                        roomName:(NSString *)roomName
                        roomUuid:(NSString *)roomUuid
                           appId:(NSString *)appId
                           token:(NSString *)token
                          region:(AgoraProctorRegion)region
                    mediaOptions:(AgoraProctorMediaOptions * _Nullable)mediaOptions
                  userProperties:(NSDictionary * _Nullable)userProperties;

The classroom launching configuration used in launch.

PropertyDescription
userNameThe user name for display in the classroom. This value must be less than 64 bytes.
userUuidThe user ID. This is the globally unique identifier of a user. This value must be the same as the User ID that you use for generating a Signaling token. The string length must be less than 64 bytes. Supported characters include lowercase and uppercase English letters, numbers, spaces, and the symbols listed in the Web userUuid description.
userRoleThe user's role in the classroom. See AgoraProctorUserRole.
roomNameThe room name for display in the classroom. The string length must be less than 64 bytes.
roomUuidThe room ID. This is the globally unique identifier of a classroom. This value must be less than 64 bytes. Supported characters include lowercase and uppercase English letters, numbers, spaces, and the symbols listed in the Web userUuid description.
appIdThe Agora App ID. See Get the Agora App ID.
tokenThe Signaling token used for authentication. See Secure authentication with tokens.
regionThe region where the classrooms are. All clients must use the same region to communicate with each other. Supported regions are CN for Mainland China, NA for North America, EU for Europe, and AP for Asia Pacific.
mediaOptionsMedia options, including the media stream encryption configuration. See AgoraProctorMediaOptions.
userPropertiesUser properties customized by the developer.
widgetsPass in widgetId and AgoraWidgetConfig.

AgoraProctorMediaOptions

@interface AgoraProctorMediaOptions : NSObject
@property (nonatomic, strong, nullable) AgoraProctorMediaEncryptionConfig *encryptionConfig;
@property (nonatomic, strong, nullable) AgoraProctorVideoEncoderConfig *videoEncoderConfig;
@property (nonatomic, assign) AgoraProctorLatencyLevel latencyLevel;

- (instancetype)initWithEncryptionConfig:(AgoraProctorMediaEncryptionConfig * _Nullable)encryptionConfig
                      videoEncoderConfig:(AgoraProctorVideoEncoderConfig * _Nullable)videoEncoderConfig
                            latencyLevel:(AgoraProctorLatencyLevel)latencyLevel;

Media options. Set in AgoraProctorLaunchConfig.

PropertyDescription
encryptionConfig(Optional) The media stream encryption configuration. See AgoraProctorMediaEncryptionConfig.
videoEncoderConfig(Optional) The video encoder configuration. See AgoraProctorVideoEncoderConfig.
latencyLevelThe latency level of an audience member. This property does not apply to cohosting users. The default value is low, which means low latency. See AgoraProctorLatencyLevel.

AgoraProctorMediaEncryptionConfig

@interface AgoraProctorMediaEncryptionConfig : NSObject
@property (nonatomic, assign) AgoraProctorMediaEncryptionMode mode;
@property (nonatomic, copy) NSString *key;

- (instancetype)initWithMode:(AgoraProctorMediaEncryptionMode)mode
                         key:(NSString *)key;

The media stream encryption configuration used in AgoraProctorMediaOptions.

PropertyDescription
modeThe encryption mode. See AgoraProctorMediaEncryptionMode.
keyThe encryption key.

AgoraProctorVideoEncoderConfig

@interface AgoraProctorVideoEncoderConfig : NSObject
@property (nonatomic, assign) NSUInteger dimensionWidth;
@property (nonatomic, assign) NSUInteger dimensionHeight;
@property (nonatomic, assign) NSUInteger frameRate;
@property (nonatomic, assign) NSUInteger bitRate;
@property (nonatomic, assign) AgoraProctorMirrorMode mirrorMode;

- (instancetype)initWithDimensionWidth:(NSUInteger)dimensionWidth
                       dimensionHeight:(NSUInteger)dimensionHeight
                             frameRate:(NSUInteger)frameRate
                               bitRate:(NSUInteger)bitRate
                            mirrorMode:(AgoraProctorMirrorMode)mirrorMode;

The video encoder configuration used in AgoraProctorMediaOptions.

PropertyDescription
dimensionWidthThe width of the video frame in pixels. The default value is 320.
dimensionHeightThe height of the video frame in pixels. The default value is 240.
frameRateThe frame rate of the video in FPS. The default value is 15.
bitRateThe bitrate of the video in Kbps. The default value is 200.
mirrorModeWhether video mirror mode is enabled. The default value is AgoraProctorMirrorModeDisable, which means mirror mode is disabled. See AgoraProctorMirrorMode.

Enums

AgoraProctorMirrorMode

Whether to enable mirror mode, used in AgoraProctorVideoEncoderConfig.

ValueDescription
disabled0: Disable mirror mode.
enabled1: Enable mirror mode.

AgoraProctorRegion

The region where classrooms are, used in AgoraProctorLaunchConfig.

ValueDescription
CN0: Mainland China.
NA1: North America.
EU2: Europe.
AP3: Asia Pacific.

AgoraProctorExitReason

The reason for exiting the Agora Proctor SDK, used in the didExit callback.

ValueDescription
normalUser exits the room normally.
kickOutUser is kicked out of the room.

AgoraProctorLatencyLevel

The latency level of an audience member, used in AgoraProctorLaunchConfig.

ValueDescription
low1: Low latency. The latency from the sender to the receiver is between 1500 ms and 2000 ms.
ultraLow2: Ultra-low latency. The latency from the sender to the receiver is between 400 ms and 800 ms.

AgoraProctorUserRole

The user role in the classroom, used in AgoraProctorLaunchConfig.

ValueDescription
invalid0: Recording robot.
teacher1: Teacher.
student2: Student.
assistant3: Assistant.
observer4: Observer.

AgoraProctorMediaEncryptionMode

The media stream encryption mode, used in AgoraProctorMediaEncryptionConfig.

ValueDescription
None0: No encryption.
AES128XTS1: 128-bit AES encryption, XTS mode.
AES128ECB2: 128-bit AES encryption, ECB mode.
AES256XTS3: 256-bit AES encryption, XTS mode.
SM4128ECB4: 128-bit SM4 encryption, ECB mode.
AES128GCM5: 128-bit AES encryption, GCM mode.
AES256GCM6: 256-bit AES encryption, GCM mode.
AES128GCM27: Enhanced 128-bit AES encryption, GCM mode. Compared with AES128GCM, this mode is more secure and requires setting a salt.
AES256GCM28: Enhanced 256-bit AES encryption, GCM mode. Compared with AES256GCM, this mode is more secure and requires setting a salt.