In v2.1.0, Agora fully optimizes the internal architecture of the Agora Classroom SDK and refactors the Agora Edu Context APIs.
This section lists the major changes of the Edu Context API between v2.1.0 and v1.1.5.
Remove AgoraEduMessageContext
and AgoraEduMessageHandler
. Use AgoraRtmIMWidget
in the AgoraWidgets
library instead.
Remove AgoraEduWhiteBoardContext
, AgoraEduWhiteBoardHandler
, AgoraEduWhiteBoardToolContext
, AgoraEduWhiteBoardPageControlContext
, and AgoraEduWhiteBoardPageControlHandler
. Use AgoraWhiteBoardWidget
in the AgoraWidgets
library instead.
Remove AgoraEduDeviceContext
and AgoraEduDeviceHandler
. Use methods and callbacks in AgoraEduMediaContext
and AgoraEduMediaHandler
instead, as follows:
Remove setCameraDeviceEnable
, setMicDeviceEnable
, and setSpeakerDeviceEnable
. Use openLocalDevice
and closeLocalDevice
in AgoraEduMediaContext
instead.
Remove switchCameraFacing
. Use openLocalDevice
in AgoraEduMediaContext
instead.
Remove onCameraDeviceEnableChanged
, onCameraDeviceFacingChanged
, onMicDeviceEnableChanged
, andonSpeakerDeviceEnableChanged
. Use onLocalDeviceStateUpdated
in AgoraEduMediaHandler
instead.
Remove AgoraEduHandsUpContext
and AgoraEduHandsUpHandler
. Use methods and callbacks in AgoraEduUserContext
and AgoraEduUserHandler
instead, as follows:
Remove updateHandsUpState
. Use handsWave
and handsDown
in AgoraEduUserContext
instead.
Remove onHandsUpState
. Use onUserHandsWave
and onUserHandsDown
in AgoraEduUserHandler
instead.
Remove onHandsUpState
. Use onUserHandsWave
and onUserHandsDown
in AgoraEduUserHandler
instead.
openCamera
as openLocalDevice
.closeCamera
as closeLocalDevice
.startPreview
as startRenderVideo
.stopPreview
as stopRenderVideo
.openMicrophone
as openLocalDevice
.closeMicrophone
as closeLocalDevice
.renderRemoteView
as startRenderVideo
.publishStream
.unpublishStream
.joinClassroom
as joinRoom
.updateFlexRoomProperties
as updateRoomProperties
.uploadLog
and onUploadLogSuccess
. Use uploadLog
in AgoraEduMonitorContext
instead.registerEventHandler
as registerRoomEventHandler
.onShowErrorInfo
.onClassroomJoined
as onRoomJoinedSuccess
.onFlexRoomPropertiesInitialize
as RoomContext.getRoomProperties
.onFlexRoomPropertiesChanged
. Use onRoomPropertiesUpdated
and onRoomPropertiesDeleted
instead.onClassroomName
. Use getRoomInfo
in AgoraEduRoomContext
instead.onClassroomState
. Use onClassStateUpdated
and onRoomClosed
instead.onClassTimeInfo
.Use getRoomInfo
in AgoraEduRoomContext
instead.onNetworkQuality
. Use onLocalNetworkQualityUpdated
in AgoraEduMonitorHandler
instead.onConnectionState
. Use onLocalConnectionUpdated
in AgoraEduMonitorHandler
instead.AgoraEduScreenShareContext
and AgoraEduScreenShareHandler
. Use AgoraEduStreamContext
instead. When videoSourceType
in AgoraEduContextStreamInfo
is screen
, you can regard this stream as a screen-sharing video stream.AgoraEduScreenShareHandler
. Use AgoraEduStreamContext
instead. Remove onUpdateScreenShareState
. Use onStreamJoined
, onStreamLeft
, and onStreamUpdate
inAgoraEduStreamHandler
instead.updateFlexUserProperties
as updateUserProperties
registerEventHandler
as registerUserEventHandler
onUpdateUserList
. Use onRemoteUserJoined
, onRemoteUserLeft
, and onUserUpdated
instead.onUpdateCoHostList
. Use onCoHostUserListAdded
and onCoHostUserListRemoved
instead.onKickOut
as onLocalUserKickOut
.onUpdateAudioVolumeIndication
. Use onVolumeUpdated
in AgoraEduMediaHandler
instead.onShowUserReward
as onUserRewarded
.onFlexUserPropertiesChanged
. Use onUserPropertiesUpdated
and onUserPropertiesDeleted
instead.onStreamUpdated
. Use onStreamUpdated
in AgoraEduStreamHandler
instead.If you changed the UI of Flexible Classroom in the versions earlier than v1.1.5, follow these steps to migrate to v1.1.5:
Follow the steps in Integrate Flexible Classroom into Your App to re-integrate Flexible Classroom v1.1.5.
Replace the files in the SDKs/AgoraEduUI directory with the files in your project's AgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppView directory, as follows:
AgoraUIManager.swift
to AgoraEduUI.swift
, and rename AgoraUIManager
class to AgoraEduUI
.AgoraEduUI.swift
fileIn AgoraEduUI.swift
, make the following changes:
Rename AgoraEduContextAppType
to AgoraEduContextRoomType
.
Change var chat: AgoraEduWidget
to var chat: AgoraBaseWidget
.
Add the following code to add the initWidgets
method.
func initWidgets() {
guard let widgetInfos = contextPool.widget.getWidgetInfos() else {
return
}
for info in widgetInfos {
switch info.widgetId {
case "AgoraChatWidget":
info.properties = ["contextPool": contextPool]
let chat = contextPool.widget.create(with: info)
chat.addMessageObserver(self)
let hasConversation = (viewType == .oneToOne ? 0 : 1)
if let message = ["hasConversation": hasConversation].jsonString() {
chat.widgetDidReceiveMessage(message)
}
self.chat = chat
default:
break
}
}
}
Replace the files in the SDKs/Modules/AgraUIEduBaseViews directory with the files in your project's AgoraEduSDK/Modules/AgraUIEduBaseViews directory, as follows:
AgoraChatWidget.swift
fileIn AgoraChatWidget.swift
, make the following changes:
Replace the initialization method with the following code:
public required init(widgetId: String,
contextPool: AgoraEduContextPool,
properties: [AnyHashable : Any]?) {
super.init(widgetId: widgetId,
contextPool: contextPool,
properties: properties)
initViews()
initLayout()
initData()
}
To add theAgoraEduMessageContext
property, add the following code:
private weak var context: AgoraEduMessageContext?
public required override init(widgetId: String,
properties: [AnyHashable: Any]?) {
super.init(widgetId: widgetId,
properties: properties)
initViews()
initLayout()
if let contextPool = properties?["contextPool"] as? AgoraEduContextPool {
context = contextPool.chat
initData()
}
}