Migration guide
Updated
Upgrade to the latest version of Flexible Classroom.
This page shows you how to upgrade to the latest version of Flexible Classroom.
Android
Migrate from v1.1.5 to v2.1.0
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.
Chat context
Remove ChatContext and IChatHandler.
Whiteboard context
Remove WhiteboardContext and IWhiteboardHandler. In v2.1.0, the whiteboard feature is implemented in AgoraUIKit.
Device context
Remove DeviceContext and IDeviceHandler. Use methods and callbacks in MediaContext and IMediaHandler instead, as follows:
- Remove
getDeviceConfig. UsegetLocalDeviceStateinstead. - Remove
setCameraDeviceEnable,switchCameraFacing,setMicDeviceEnable, andsetSpeakerEnable. UseopenSystemDeviceandcloseSystemDeviceinstead. - Remove
setDeviceLifecycle. In v2.1.0, the SDK does not maintain the device state. - Remove
onCameraDeviceEnableChanged,onCameraFacingChanged,onMicDeviceEnabledChanged, andonSpeakerEnabledChanged. UseonLocalDeviceStateUpdatedinstead. - Remove
onDeviceTips.
Hands-up context
Remove HandsUpContext and IHandsUpHandler. Use methods and callbacks in UserContext and IUserHandler instead, as follows:
- Remove
performHandsUp. UsehandsWaveandhandsDowninstead. - Remove
onHandsUpEnabled. UseonHandsWaveEnabledinstead. - Remove
onHandsUpStateUpdatedandonHandsUpStateResultUpdated. UseonUserHandsWaveandonUserHandsDowninstead. - Remove
onHandsUpTips.
Room context
- Remove
roomInfo. UsegetRoomInfoinstead. - Remove
leave. UseleaveRoominstead. - Move
uploadLogtoMonitorContext. - Remove
updateFlexRoomProps. UseupdateRoomPropertiesanddeleteRoomPropertiesinstead. - Rename
joinClassroomasjoinRoom. - Remove
onClassroomName. You can callgetRoomInfoto get the room name. - Rename
onClassStateasonClassStateUpdated. - Remove
onClassTime. - Remove
onNetworkStateChanged. UseonLocalNetworkQualityUpdatedinIMonitorHandlerinstead. - Remove
onLogUploaded. You can get the logserailNumberwith the callback function in theuploadLogmethod inMonitorContext. - Remove
onConnectionStateChanged. UseonLocalConnectionUpdatedinIMonitorHandlerinstead. - Remove
onClassTip. - Remove
onFlexRoomPropsInitialized. To get room custom properties after joining the room, you can callgetRoomProperties. - Remove
onFlexRoomPropsChanged. UseonRoomPropertiesUpdatedandonRoomPropertiesDeletedinstead. - Remove
onError. - Remove
onClassroomJoinSuccessandonClassroomJoinFail. UsecallbackinjoinRoominstead. - Remove
onClassroomLeft. UseonRoomClosedinstead.
Screen-sharing context
- Remove
ScreenShareContext. UseStreamContextinstead. WhenvideoSourceTypeinAgoraEduContextStreamInfoisScreen, you can regard this stream as a screen-sharing video stream. - Remove
IScreenShareHandler. UseIStreamHandlerinstead. RemoveonUpdateScreenShareState. UseonStreamJoined,onStreamLeft, andonStreamUpdatedinIStreamHandlerinstead.
User context
- Remove
localUserInfo. UsegetLocalUserInfoinstead. - Remove
muteVideoandmuteAudio. UsemuteStreamsinStreamContextinstead. - Remove
renderVideo. UsestartRenderLocalVideoandstartRenderRemoteVideoinMediaContextinstead. - Remove
updateFlexUserProps. UseupdateUserPropertiesanddeleteUserPropertiesinstead. - Remove
setVideoEncoderConfig. UsesetLocalVideoConfiginStreamContextinstead. - Remove
onUserListUpdated. UsegetAllUserListandgetUserListinUserContextandonRemoteUserJoined,onRemoteUserLeft, andonUserUpdatedinUserHandlerinstead. - Remove
onCoHostListUpdated. UseonCoHostUserListAddedandonCoHostUserListRemovedinstead. You can also get the information of all on-stage users throughgetCoHostListinUserContext. - Rename
onUserRewardtoonUserRewarded. - Rename
onKickOutasonLocalUserKickedOut. - Remove
onUserTipandonRoster. - Remove
onFlexUserPropsChanged. UseonUserPropertiesUpdatedandonUserPropertiesDeletedinIUserHandlerinstead. You can also get custom user properties throughgetUserPropertiesinUserContext.
iOS
Migrate from v1.1.5 to v2.1.0
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.
Chat context
Remove AgoraEduMessageContext and AgoraEduMessageHandler. Use AgoraRtmIMWidget in the AgoraWidgets library instead.
Whiteboard context
Remove AgoraEduWhiteBoardContext, AgoraEduWhiteBoardHandler, AgoraEduWhiteBoardToolContext, AgoraEduWhiteBoardPageControlContext, and AgoraEduWhiteBoardPageControlHandler. Use AgoraWhiteBoardWidget in the AgoraWidgets library instead.
Device context
- Remove
AgoraEduDeviceContextandAgoraEduDeviceHandler. Use methods and callbacks inAgoraEduMediaContextandAgoraEduMediaHandlerinstead, as follows: - Remove
setCameraDeviceEnable,setMicDeviceEnable, andsetSpeakerDeviceEnable. UseopenLocalDeviceandcloseLocalDeviceinAgoraEduMediaContextinstead. - Remove
switchCameraFacing. UseopenLocalDeviceinAgoraEduMediaContextinstead. - Remove
onCameraDeviceEnableChanged,onCameraDeviceFacingChanged,onMicDeviceEnableChanged, andonSpeakerDeviceEnableChanged. UseonLocalDeviceStateUpdatedinAgoraEduMediaHandlerinstead.
Hands-up context
- Remove
AgoraEduHandsUpContextandAgoraEduHandsUpHandler. Use methods and callbacks inAgoraEduUserContextandAgoraEduUserHandlerinstead, as follows: - Remove
updateHandsUpState. UsehandsWaveandhandsDowninAgoraEduUserContextinstead. - Remove
onHandsUpState. UseonUserHandsWaveandonUserHandsDowninAgoraEduUserHandlerinstead.
Media context
- Rename
openCameraasopenLocalDevice. - Rename
closeCameraascloseLocalDevice. - Rename
startPreviewasstartRenderVideo. - Rename
stopPreviewasstopRenderVideo. - Rename
openMicrophoneasopenLocalDevice. - Rename
closeMicrophoneascloseLocalDevice. - Rename
renderRemoteViewasstartRenderVideo. - Remove
publishStream. - Remove
unpublishStream.
Room context
- Rename
joinClassroomasjoinRoom. - Rename
updateFlexRoomPropertiesasupdateRoomProperties. - Remove
uploadLogandonUploadLogSuccess. UseuploadLoginAgoraEduMonitorContextinstead. - Rename
registerEventHandlerasregisterRoomEventHandler. - Remove
onShowErrorInfo. - Rename
onClassroomJoinedasonRoomJoinedSuccess. - Rename
onFlexRoomPropertiesInitializeasRoomContext.getRoomProperties. - Remove
onFlexRoomPropertiesChanged. UseonRoomPropertiesUpdatedandonRoomPropertiesDeletedinstead. - Remove
onClassroomName. UsegetRoomInfoinAgoraEduRoomContextinstead. - Remove
onClassroomState. UseonClassStateUpdatedandonRoomClosedinstead. - Remove
onClassTimeInfo. UsegetRoomInfoinAgoraEduRoomContextinstead. - Remove
onNetworkQuality. UseonLocalNetworkQualityUpdatedinAgoraEduMonitorHandlerinstead. - Remove
onConnectionState. UseonLocalConnectionUpdatedinAgoraEduMonitorHandlerinstead.
Screen-sharing context
- Remove
AgoraEduScreenShareContextandAgoraEduScreenShareHandler. UseAgoraEduStreamContextinstead. WhenvideoSourceTypeinAgoraEduContextStreamInfoisscreen, you can regard this stream as a screen-sharing video stream. - Remove
AgoraEduScreenShareHandler. UseAgoraEduStreamContextinstead. RemoveonUpdateScreenShareState. UseonStreamJoined,onStreamLeft, andonStreamUpdateinAgoraEduStreamHandlerinstead.
User context
- Rename
updateFlexUserPropertiesasupdateUserProperties - Rename
registerEventHandlerasregisterUserEventHandler - Remove
onUpdateUserList. UseonRemoteUserJoined,onRemoteUserLeft, andonUserUpdatedinstead. - Remove
onUpdateCoHostList. UseonCoHostUserListAddedandonCoHostUserListRemovedinstead. - Rename
onKickOutasonLocalUserKickOut. - Remove
onUpdateAudioVolumeIndication. UseonVolumeUpdatedinAgoraEduMediaHandlerinstead. - Rename
onShowUserRewardasonUserRewarded. - Remove
onFlexUserPropertiesChanged. UseonUserPropertiesUpdatedandonUserPropertiesDeletedinstead. - Remove
onStreamUpdated. UseonStreamUpdatedinAgoraEduStreamHandlerinstead.
Migrate to 1.1.5
If you changed the UI of Flexible Classroom in versions earlier than v1.1.5, follow these steps to migrate to v1.1.5:
Step 1: Re-integrate Flexible Classroom
Follow the steps in Integrate Flexible Classroom into Your App to re-integrate Flexible Classroom v1.1.5.
Step 2: Replace the files in the SDKs/AgoraEduUI directory
Replace the files in the SDKs/AgoraEduUI directory with the files in your project's AgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppView directory, as follows:
- Replace
SDKs/AgoraEduUI/AgoraEduUI/AgoraResourceswithAgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppViews/AgoraResources. - Replace
SDKs/AgoraEduUI/AgoraEduUI/RenderwithAgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppViews/Render. - Replace
SDKs/AgoraEduUI/AgoraEduUI/UIControllerwithAgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppViews/UIController. - Replace
SDKs/AgoraEduUI/AgoraEduUI/WhiteBoardwithAgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppViews/WhiteBoard. - Replace
SDKs/AgoraEduUI/AgoraEduUI/AgoraEduUI.xcassetswithAgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppViews/AgoraUIEduAppViews.xcassets. - Replace
SDKs/AgoraEduUI/AgoraEduUI/UIManagerwithAgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppViews/UIManager, renameAgoraUIManager.swifttoAgoraEduUI.swift, and renameAgoraUIManagerclass toAgoraEduUI. - Replace
Widgets/AgoraWidgets/ChatwithAgoraEduSDK/Modules/AgoraUIEduAppViews/AgoraUIEduAppViews/Widget.
Step 3: Edit the AgoraEduUI.swift file
In AgoraEduUI.swift, make the following changes:
-
Rename
AgoraEduContextAppTypetoAgoraEduContextRoomType. -
Change
var chat: AgoraEduWidgettovar chat: AgoraBaseWidget. -
Add the following code to add the
initWidgetsmethod: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 } } }
Step 4: Replace the files in the SDKs/Modules/AgraUIEduBaseViews directory
Replace the files in the SDKs/Modules/AgraUIEduBaseViews directory with the files in your project's AgoraEduSDK/Modules/AgraUIEduBaseViews directory, as follows:
- Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraResourceswithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraResources. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraAlertViewwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraAlertView. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraAnimatedImagewithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraAnimatedImage. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraHandsUpViewwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraHandsUpView. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraRefreshwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraRefresh. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraToastViewwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraToastView. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraUIEduBaseViews.xcassetswithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraUIEduBaseViews.xcassets. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraUINavigationBarwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraUINavigationBar. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraUIUserViewwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraUIUserView. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraUserListViewwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraUserListView. - Replace
SDKs/Modules/AgraUIEduBaseViews/AgoraUserRenderListViewwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraUserRenderListView. - Replace
SDKs/Modules/AgraUIEduBaseViews/UtilswithAgoraEduSDK/Modules/AgraUIEduBaseViews/Utils. - Replace
Widgets/AgoraWidgets/ChatwithAgoraEduSDK/Modules/AgraUIEduBaseViews/AgoraUIChatView.
Step 5: Edit the AgoraChatWidget.swift file
In 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 the
AgoraEduMessageContextproperty, 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() } }
Web
You do not need to migrate your code for this platform.
Electron
You do not need to migrate your code for this platform.
