RoomContext
provides the methods that can be called by your app for classroom management.
abstract fun roomInfo(): EduContextRoomInfo
Gets the classroom information. See EduContextRoomInfo.
abstract fun uploadLog(quiet: Boolean = false)
Uploads the logs.
Parameter | Description |
---|---|
quiet |
Whether to upload the logs silently: |
abstract fun updateFlexRoomProps(properties: MutableMap<String, String>,
cause: MutableMap<String, String>?)
Adds or updates custom classroom properties. For details, see How can I set classroom properties?
After you successfully update the properties, the remote client receives the onFlexRoomPropertiesChanged
callback.
Parameter | Description |
---|---|
properties |
Classroom properties. |
cause |
The update reason. |
abstract fun leave(exit: Boolean = true)
Leaves the classroom.
Parameter | Description |
---|---|
exit |
Whether to exit the current page. |
abstract fun joinClassroom()
Joins a classroom.
IRoomHandler
reports the classroom-related event callbacks to your app.
fun onClassroomName(name: String)
Indicates the classroom name.
Parameter | Description |
---|---|
name |
The classroom name. |
fun onClassState(state: EduContextClassState)
Indicates the classroom state.
Parameter | Description |
---|---|
state |
The classroom state. See EduContextClassState for details. |
fun onClassTime(time: String)
Reports the class time.
Init
, time
indicates how many seconds are left before the class begins.Start
, time
indicates how many seconds the class has lasted.End
, time
means how many seconds the class has gone over time.Parameter | Description |
---|---|
time |
The class time. |
fun onNetworkStateChanged(state: EduContextNetworkState)
Reports the network state.
Parameter | Description |
---|---|
state |
The network state. See EduContextNetworkState for details. |
fun onLogUploaded(logData: String)
Occurs when the log upload completes.
Parameter | Description |
---|---|
logData |
The serialNum of this log upload. |
fun onConnectionStateChanged(state: EduContextConnectionState)
Indicates the connection state.
Parameter | Description |
---|---|
state |
The connection state. See EduContextConnectionState for details. |
fun onClassTip(tip: String)
Class notifications.
There are the following tips:
Parameter | Description |
---|---|
tip |
The notification. |
fun onError(error: EduContextError)
Reports the error message during the class.
Parameter | Description |
---|---|
error |
The error message. See EduContextErro for details. |
fun onFlexRoomPropsInitialized(properties: MutableMap<String, Any>)
Reports the initial custom classroom properties.
Parameter | Description |
---|---|
properties |
All classroom properties. |
fun onFlexRoomPropsChanged(changedProperties: MutableMap<String, Any>,
properties: MutableMap<String, Any>,
cause: MutableMap<String, Any>?,
operator: EduContextUserInfo?)
Occurs when the custom classroom properties are updated.
Parameter | Description |
---|---|
changedProperties |
The updated classroom properties. |
properties |
All classroom properties. |
cause |
The update reason. |
operator |
The information of the operator. See EduContextUserInfo. operator being empty means that properties are updated by the server. |
fun onClassroomJoinSuccess(roomUuid: String, timestamp: Long)
Occurs when the local client successfully joins the classroom.
Parameter | Description |
---|---|
roomUuid |
The classroom ID. |
timestamp |
Timestamp when the local client joins the classroom. |
fun onClassroomJoinFail(roomUuid: String, code: Int?, msg: String?, timestamp: Long)
Occurs when the local client fails to join the classroom.
Parameter | Description |
---|---|
roomUuid |
The classroom ID. |
timestamp |
Timestamp when the local client fails to join the classroom. |
fun onClassroomLeft(roomUuid: String, timestamp: Long, exit: Boolean = true)
Occurs when the local client successfully leaves the classroom.
Parameter | Description |
---|---|
roomUuid |
The classroom ID. |
timestamp |
Timestamp when the local client leaves the classroom. |
exit |
Whether to exit the current page. When a class ends, the user does not automatically exit the page. Developers need to remind the user of exiting the page through a pop-up window. When the user is kicked out of the class, the user automatically exits the page. |