API Overview

Agora Edu Context enables developers to implement the functions in the Flexible Classroom. Different contexts represent different function modules in the Flexible Classroom. Each context contains methods for the app to call and also reports event callbacks to the app.

Media Context

Method Description
getLocalDevices Gets the local devices.
openLocalDevice Turns on the specified local device.
closeLocalDevice Turns off the local device.
getLocalDeviceState Gets the state of the local device.
startRenderLocalVideo Starts rendering the video stream.
stopRenderLocalVideo Stops rendering the video stream.
startAudioMixing Starts audio mixing.
stopAudioMixing Stops audio mixing.
setAudioMixingPosition Sets the starting position of the music file for mixing.
onVolumeUpdated Indicates the volume change of a stream.
onLocalDeviceStateUpdated Occurs when the local device state changes.
onLocalDeviceConnected Occurs when the local device is connected.
onLocalDeviceDisconnected Occurs when the local device is disconnected.
onAudioMixingStateChanged Occurs when the audio mixing state changes.

Monitor Context

Method Description
uploadLog Uploads the logs.
onLocalNetworkQualityUpdated Occurs when the local network quality changes.
onLocalConnectionUpdated Occurs when the connection between the local client and the Agora server changes.

Room Context

Method Description
joinRoom Joins a room.
leaveRoom Leaves the room.
getRoomInfo Gets the room information.
getRoomProperties Gets custom room properties.
updateRoomProperties Adds or updates custom room properties.
deleteRoomProperties Deletes custom room properties.
onJoinRoomSuccess Occurs when the local user successfully joins the room.
onJoinRoomFailure Occurs when the local user fails to join the room.
onRoomPropertiesUpdated Occurs when the custom room properties are updated.
onRoomPropertiesDeleted Occurs when custom room properties are deleted.
onRoomClosed Occurs when the room is closed.
onClassStateUpdated Occurs when the class state changes.

Stream Context

Method Description
getStreamInfo Gets all streams of the specified user.
getAllStreamInfo Gets all streams.
setLocalVideoConfig Sets the encoding configurations for the local video stream.
setRemoteVideoStreamSubscribeLevel Subscribes to high-resolution or low-resolution video streams.
onStreamUpdated Occurs when a stream is updated.
onStreamJoined Occurs when a stream is added to the room.
onStreamLeft Occurs when a stream is removed from the room.

User Context

Method Description
getLocalDevices Gets the local devices.
getCoHostList Gets the information of all users on the "stage".
getUserList Gets the user information of the specified role.
getAllUserList Gets the information of all users in the room.
updateUserProperties Adds or updates custom user properties.
deleteUserProperties Deletes custom user properties.
getUserProperties Gets the custom properties of the specified user.
getUserRewardCount Gets the number of rewards owned by the specified user.
getHandsWaveEnable Checks whether the "raising a hand" feature is enabled.
handsWave Raises the hand to apply for speaking on the "stage".
handsDown Puts down the hand.
onRemoteUserJoined Occurs when a remote user joins the room.
onRemoteUserLeft Occurs when a remote user leaves the room.
onUserUpdated Occurs when the information of a user is updated.
onCoHostUserListAdded Occurs when users successfully go onto the "stage".
onCoHostUserListRemoved Occurs when users go off the "stage".
onUserPropertiesUpdated Occurs when the custom user properties are updated.
onUserPropertiesDeleted Occurs when the custom user properties are deleted.
onUserRewarded Occurs when the number of a user's rewards changes.
onLocalUserKickedOut Occurs when the local user is kicked out of the room.
onHandsWaveEnabled Indicates whether the "raising a handing" feature is enabled.
onUserHandsWave Occurs when a user raises a hand.
onUserHandsDown Occurs when a user puts down the hand.