Classroom client SDK
This page provides the Kotlin API reference of the Agora Classroom SDK for Android.
AgoraClassSdk
AgoraClassSdk
is the basic interface of the Agora Classroom SDK and provides the main methods that can be invoked by your app.
version
Gets the SDK version.
Returns
The SDK version.
setConfig
Globally configures the SDK.
Sample code
Parameter
Parameter | Description |
---|---|
agoraEduSDKConfig | The SDK global configuration. See AgoraClassSdkConfig. |
launch
Launches a flexible classroom.
Sample code
Parameter
Parameter | Description |
---|---|
context | The context of the app. |
config | The classroom launching configuration. See AgoraEduLaunchConfig. |
callback | The SDK uses the AgoraEduLaunchCallback class to report events related to classroom launching to the app. |
Returns
The AgoraEduClassRoom
class.
configCourseWare
Configures courseware downloading.
Sample code
Parameter
Parameter | Description |
---|---|
wares | The courseware pre-download configuration. See AgoraEduCourseware. |
downloadCourseWare
Pre-downloads the courseware.
Sample code
Parameter
Parameter | Description |
---|---|
context | The context of the app. |
listener | The SDK reports events related to courseware preloading to the app through the AgoraEduCoursewarePreloadListener class. |
registerExtensionApp
Register an extension application by using the ExtApp tool. ExtApp is a tool for embedding extension applications in Flexible Classroom. For details, see Customize Flexible Classroom with ExtApp.
AgoraEduLaunchCallback
The AgoraEduLaunchCallback
class reports events related to classroom launching to the app.
onCallback
Reports classroom events.
Parameter | Description |
---|---|
state | The classroom events. See AgoraEduEvent. |
AgoraEduCoursewarePreloadListener
The AgoraEduCoursewarePreloadListener
class reports events related to courseware preloading to the app.
onStartDownload
Indicates that the SDK starts downloading the courseware.
Parameter | Description |
---|---|
ware | The courseware pre-download configuration. See AgoraEduCourseware. |
onProgress
Indicates the progress of courseware pre-downloading.
Parameter | Description |
---|---|
ware | The courseware pre-download configuration. See AgoraEduCourseware. |
progress | Indicates the progress of courseware pre-downloading. |
onComplete
Indicates that the courseware pre-downloading completes.
Parameter | Description |
---|---|
ware | The courseware pre-download configuration. See AgoraEduCourseware. |
onFailed
The courseware pre-downloading fails.
Parameter | Description |
---|---|
ware | The courseware pre-download configuration. See AgoraEduCourseware. |
Type definition
AgoraClassSdkConfig
The SDK global configuration. Used in setConfig.
Attributes | Description |
---|---|
appId | The Agora App ID. See Get the Agora App ID. |
eyeCare | Whether to enable eye care mode:0 : (Default) Disable eye care mode.1 : Enable eye care mode. |
AgoraEduLaunchConfig
The classroom launching configuration. Used in launch.
Attributes | Description |
---|---|
userName | The user name for display in the classroom. The string length must be less than 64 bytes. |
userUuid | The user ID. This is the globally unique identifier of a user. Must be the same as the User ID that you use for generating an Signaling token. The string length must be less than 64 bytes. Supported character scopes are: |
roomName | The room name for display in the classroom. The string length must be less than 64 bytes. |
roomUuid | The room ID. This is the globally unique identifier of a classroom. The string length must be less than 64 bytes. Supported character scopes are: |
roleType | The role of the user in the classroom. See AgoraEduRoleType. |
roomType | The classroom type. See AgoraEduRoomType. |
rtmToken | The Signaling token used for authentication. For details, see Secure authentication with tokens. |
startTime | The start time (ms) of the class, determined by the first user joining the classroom. |
duration | The duration (ms) of the class, determined by the first user joining the classroom. |
region | The region where the classrooms is located. All clients must use the same region, otherwise, they may fail to communicate with each other. See AgoraEduRegionStr. |
videoEncoderConfig | Video encoding configurations, including the width and height, frame rate, and bitrate. See EduVideoEncoderConfig |
mediaOptions | The media options, including media encryption configurations. See AgoraEduMediaOptions. |
boardFitMode | The PPT display mode. See AgoraBoardFitMode. |
streamState | Controls whether students automatically send audio or video streams after they go onto the stage. See StreamState. |
latencyLevel | The latency level of an audience member. See AgoraEduLatencyLevel. |
userProperties | User properties customized by the developer. For details, see How can I set user properties? |
AgoraEduEvent
Classroom events. Reported in onCallback.
Attributes | Description |
---|---|
AgoraEduEventFailed | 0 : The user fails to enter the classroom. |
AgoraEduEventReady | 1 : The classroom is ready. |
AgoraEduEventDestroyed | 2 : The classroom has been destroyed. |
AgoraEduEventForbidden | 3 : The user is forbidden by the Flexible Classroom cloud service and not allowed to enter the classroom. |
AgoraEduRoleType
The role of the user in the classroom. Set in AgoraEduLaunchConfig.
Attributes | Description |
---|---|
AgoraEduRoleTypeStudent | 2 : A student. |
AgoraEduRoomType
The classroom type. Set in AgoraEduLaunchConfig.
Attributes | Description |
---|---|
AgoraEduRoomType1V1 | 0 : One-to-one Classroom. An online teacher gives an exclusive lesson to only one student. |
AgoraEduRoomTypeBig | 2 : Lecture Hall. A teacher gives an online lesson to multiple students. Students do not send their audio and video by default. The maximum number of users in a classroom is 5,000. During the class, students can raise their hands to attract the teacher's attention and request to speak up. Once the teacher approves, the student can send their audio and video to interact with the teacher. |
AgoraEduRoomTypeSmall | 4 : Small Classroom. A teacher gives an online lesson to multiple students. Students do not send their audio and video by default. The maximum number of users in a classroom is 200. During the class, the teacher can invite students to speak up and have real-time audio and video interactions with the teacher. |
AgoraBoardFitMode
The PPT display mode on the whiteboard. Set in AgoraEduLaunchConfig.
Parameter | Description |
---|---|
Auto | (Default) The PPT display mode is fit, which means uniformly scaling the PPT until one of its dimensions fits the boundary. |
Retain | In this mode, if the student manually adjusts the PPT size, the client maintains this size no matter what class the student joins. |
StreamState
Controls whether students automatically send audio or video streams after they go onto the stage. Set in AgoraEduLaunchConfig.
Parameter | Description |
---|---|
videoState | Whether to send the video stream:0 : (Default) Do not send the video stream.1 : Send the video stream. |
audioState | Whether to send the audio stream:0 : (Default) Do not send the audio stream.1 : Send the audio stream. |
AgoraEduLatencyLevel
The latency level of an audience member. Set in AgoraEduLaunchConfig.
Parameter | Description |
---|---|
AgoraEduLatencyLevelLow | Low latency. The latency from the sender to the receiver is 1500 ms to 2000 ms. |
AgoraEduLatencyLevelUltraLow | (Default) Ultra-low latency. The latency from the sender to the receiver is 400 ms to 800 ms. |
AgoraEduMediaOptions
Media options. Set in AgoraEduLaunchConfig.
Parameter | Description |
---|---|
encryptionConfig | The media stream encryption configuration. See AgoraEduMediaEncryptionConfig for details. |
AgoraEduMediaEncryptionConfig
The media stream encryption configuration. Used in AgoraEduMediaOptions.
Parameter | Description |
---|---|
mode | The encryption mode. See AgoraEduEncryptMode . |
key | The encryption key. |
AgoraEduEncryptMode
The media stream encryption configuration. See AgoraEduMediaEncryptionConfig for details.
Parameter | Description |
---|---|
NONE | No encryption. |
AES_128_XTS | 128-bit AES encryption, XTS mode. |
AES_128_ECB | 128-bit AES encryption, ECB mode. |
AES_256_XTS | 256-bit AES encryption, XTS mode. |
SM4_128_ECB | 128-bit ECB encryption, SM4 mode. |
AES_128_GCM | 128-bit AES encryption, GCM mode. |
AES_256_GCM | 256-bit AES encryption, GCM mode. |
AgoraEduCourseware
The courseware pre-download configuration. Used in configCoursewares.
Attributes | Description |
---|---|
resourceName | The file name. |
scenePath | The local path for storing the file. Agora recommends setting this parameter as the combination of resourceName and name of the first SceneInfo object in scenes , such as, resourceName + "/" + sceneInfos.get(0).name . |
scenes | A list of converted file pages, an array of SceneInfo objects. Flexible Classroom automatically converts files with the suffixes of "ppt" , "pptx" , "doc" , "docx" , and "pdf" to formats that can be displayed on the whiteboard in the classroom and then display the file on the whiteboard in pages. Each SceneInfo object represents one page. |
resourceUrl | The URL address of the file, such as "https://convertcdn.netless.link/dynamicConvert/{taskUuid}.zip" . |
SceneInfo
The detailed information of a page. Set in AgoraEduCourseware.
Attributes | Description |
---|---|
componentCount | The number of pages. |
ppt | The detailed information of a converted page. See Ppt. |
name | The page name. |
Ppt
The detailed information of a page displayed on the whiteboard. Set in SceneInfo.
Attributes | Description |
---|---|
src | The URL address of the converted page. |
width | The width (pixel) of the page. |
height | The height (pixel) of the page. |
AgoraEduRegion
Regions.
Attributes | Description |
---|---|
CN | Mainland China. |
NA | North America. |
EU | Europe. |
AP | Asia Pacific. |
EduVideoEncoderConfig
The video encoder configuration. Used in AgoraEduLaunchConfig.
- In the Small Classroom scenario, the default resolution is 120p (160*120).
- In the One-to-one Classroom and Lecture Hall scenarios, the default resolution is 240p (320*240).
Parameter | Description |
---|---|
width | Width (pixel) of the video frame. |
height | Height (pixel) of the video frame. |
frameRate | The frame rate (fps) of the video. The default value is 15. |
bitrate | The bitrate (Kbps) of the video. The default value is 200. |
mirrorMode | Video mirror modes. See EduMirrorMode . |
EduMirrorMode
Whether to enable mirror mode. Used in EduVideoEncoderConfig.
Parameter | Description |
---|---|
AUTO | The SDK disables mirror mode by default. |
ENABLED | Enable mirror mode. |
DISABLED | Disable mirror mode. |