Skip to content

Feature/appliance plugin #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: release/2.8.102
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package io.agora.online.whiteboard

import android.content.Context
import android.os.Handler
import android.os.Looper
import androidx.core.content.ContextCompat
import com.herewhite.sdk.*
import com.herewhite.sdk.domain.*
import com.herewhite.sdk.window.SlideListener
import io.agora.agoraeducore.core.internal.base.PreferenceManager
import io.agora.agoraeducore.core.internal.base.ToastManager
import io.agora.agoraeducore.core.internal.education.impl.Constants
import io.agora.agoraeducore.core.internal.framework.utils.GsonUtil
import io.agora.agoraeducore.core.internal.log.LogX
import io.agora.online.R
import io.agora.online.impl.whiteboard.AudioMixerBridgeImpl
import io.agora.online.impl.whiteboard.FcrWhiteboardConverter
import io.agora.online.impl.whiteboard.WhiteBoardAudioMixingBridgeListener
Expand All @@ -25,11 +31,14 @@ import java.lang.reflect.Proxy
* date : 2022/6/7
* description :
*/
class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
class FcrBoardRoom(var whiteBoardView: WhiteboardView) : SlideListener {
var whiteBoardSDKLog: FcrBoardSDKLog = FcrBoardSDKLog()
lateinit var whiteSdk: WhiteSdk
var context: Context = whiteBoardView.context
var roomParams: RoomParams? = null
var retryTime = 0
val TAG = "WhiteBoardSDK"
val handler = Handler(Looper.getMainLooper())
var roomListener: FcrBoardRoomListener? = null
set(value) {
whiteBoardSDKLog.roomListener = value
Expand Down Expand Up @@ -70,6 +79,7 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
configuration.isUserCursor = true
configuration.region = FcrWhiteboardConverter.convertStringToRegion(region)
configuration.useMultiViews = true
configuration.isEnableAppliancePlugin = true;

whiteSdk = WhiteSdk(
whiteBoardView,
Expand All @@ -78,6 +88,41 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
whiteBoardSDKLog,
AudioMixerBridgeImpl(whiteboardMixingBridgeListener)
)
whiteSdk.setSlideListener(this);
}

override fun onSlideError(
errorType: SlideErrorType?,
errorMsg: String?,
slideId: String?,
slideIndex: Int
) {
if (errorType == SlideErrorType.RESOURCE_ERROR || errorType == SlideErrorType.CANVAS_CRASH) {
if (this.retryTime == 0) {
this.retry(slideId!!, slideIndex)
} else if (this.retryTime < 5) {
handler.postDelayed({
this.retry(slideId!!, slideIndex)
}, 5000)
} else {
this.retryTime = 0
ContextCompat.getMainExecutor(context).execute {
ToastManager.showShort(context, R.string.fcr_board_slide_retry_failure)
}
}
} else if (errorType == SlideErrorType.RUNTIME_ERROR) {
this.whiteSdk.recoverSlide(slideId, slideIndex)
} else if(errorType == SlideErrorType.RUNTIME_WARN){
LogX.w(TAG, "slide page: ${slideIndex}, error: ${errorMsg.toString()}")
}
}

private fun retry(slideId: String, slideIndex: Int){9
this.retryTime += 1
this.whiteSdk.recoverSlide(slideId, slideIndex)
ContextCompat.getMainExecutor(whiteBoardView.context).execute{
ToastManager.showShort(context.getString(R.string.fcr_board_slide_retry) + this.retryTime + "/5")
}
}

fun join(config: FcrBoardRoomJoinConfig) {
Expand Down
2 changes: 2 additions & 0 deletions AgoraCloudScene/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
<string name="fcr_user_tutor_left">外教已離開教室</string>

<!-- ****************** 白板Netless Board ****************** -->
<string name="fcr_board_slide_retry">課件加載失敗,正在重試</string>
<string name="fcr_board_slide_retry_failure">課件加載失敗,請切換下一頁或關閉課件后重新打開</string>
<string name="fcr_netless_board_granted">你已被老師授權,請使用白板工具互動</string>
<string name="fcr_netless_board_ungranted">你已被老師收回授權,無法使用白板工具互動</string>

Expand Down
2 changes: 2 additions & 0 deletions AgoraCloudScene/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
<string name="fcr_user_tutor_left">外教已离开教室</string>

<!-- ****************** 白板Netless Board ****************** -->
<string name="fcr_board_slide_retry">课件加载失败,正在重试</string>
<string name="fcr_board_slide_retry_failure">课件加载失败,请切换下一页或关闭课件后重新打开</string>
<string name="fcr_netless_board_granted">你已被老师授权,请使用白板工具互动</string>
<string name="fcr_netless_board_ungranted">你已被老师收回授权,无法使用白板工具互动</string>

Expand Down
2 changes: 2 additions & 0 deletions AgoraCloudScene/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
<string name="fcr_user_tutor_left">The teacher has left the classroom</string>

<!-- ****************** 白板Netless Board ****************** -->
<string name="fcr_board_slide_retry">course load failure, retry now.</string>
<string name="fcr_board_slide_retry_failure">course load failure, please load next page or reopen.</string>
<string name="fcr_netless_board_granted">You can now annotate on the whiteboard.</string>
<string name="fcr_netless_board_ungranted">Your access to the whiteboard has been revoked by the teacher.</string>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package io.agora.agoraeduuikit.whiteboard

import android.content.Context
import android.os.Handler
import android.os.Looper
import androidx.core.content.ContextCompat
import com.herewhite.sdk.*
import com.herewhite.sdk.domain.*
import com.herewhite.sdk.window.SlideListener
import io.agora.agoraeducore.core.internal.base.PreferenceManager
import io.agora.agoraeducore.core.internal.base.ToastManager
import io.agora.agoraeducore.core.internal.education.impl.Constants
import io.agora.agoraeducore.core.internal.framework.utils.GsonUtil
import io.agora.agoraeducore.core.internal.log.LogX
import io.agora.agoraeduuikit.R
import io.agora.agoraeduuikit.component.toast.AgoraUIToast
import io.agora.agoraeduuikit.impl.whiteboard.AudioMixerBridgeImpl
import io.agora.agoraeduuikit.impl.whiteboard.FcrWhiteboardConverter
import io.agora.agoraeduuikit.impl.whiteboard.WhiteBoardAudioMixingBridgeListener
Expand All @@ -25,7 +32,7 @@ import java.lang.reflect.Proxy
* date : 2022/6/7
* description :
*/
class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
class FcrBoardRoom(var whiteBoardView: WhiteboardView) : SlideListener {
var whiteBoardSDKLog: FcrBoardSDKLog = FcrBoardSDKLog()
lateinit var whiteSdk: WhiteSdk
var context: Context = whiteBoardView.context
Expand All @@ -36,7 +43,8 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
whiteBoardSDKLog.roomListener = value
field = value
}

var retryTime = 0
val handler = Handler(Looper.getMainLooper())
var mixingBridgeListener: ((AgoraBoardInteractionPacket) -> Unit)? = null

val boardRoom = Proxy.newProxyInstance(BoardRoom::class.java.classLoader, arrayOf(BoardRoom::class.java),
Expand All @@ -59,6 +67,40 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
}
}) as BoardRoom

override fun onSlideError(
errorType: SlideErrorType?,
errorMsg: String?,
slideId: String?,
slideIndex: Int
) {
if (errorType == SlideErrorType.RESOURCE_ERROR || errorType == SlideErrorType.CANVAS_CRASH) {
if (this.retryTime == 0) {
this.retry(slideId!!, slideIndex)
} else if (this.retryTime < 5) {
handler.postDelayed({
this.retry(slideId!!, slideIndex)
}, 5000)
} else {
this.retryTime = 0
ContextCompat.getMainExecutor(context).execute {
ToastManager.showShort(context, R.string.fcr_board_slide_retry_failure)
}
}
} else if (errorType == SlideErrorType.RUNTIME_ERROR) {
this.whiteSdk.recoverSlide(slideId, slideIndex)
} else if(errorType == SlideErrorType.RUNTIME_WARN){
LogX.w(TAG, "slide page: ${slideIndex}, error: ${errorMsg.toString()}")
}
}

private fun retry(slideId: String, slideIndex: Int){
this.retryTime += 1
this.whiteSdk.recoverSlide(slideId, slideIndex)
ContextCompat.getMainExecutor(whiteBoardView.context).execute{
ToastManager.showShort(context.getString(R.string.fcr_board_slide_retry) + this.retryTime + "/5")
}
}

fun init(whiteBoardAppId: String, region: String?) {
WhiteDisplayerState.setCustomGlobalStateClass(BoardState::class.java)
val isDebugMode = PreferenceManager.get(Constants.KEY_SP_USE_OPEN_TEST_MODE, false)
Expand All @@ -71,14 +113,16 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
configuration.isUserCursor = true
configuration.region = FcrWhiteboardConverter.convertStringToRegion(region)
configuration.useMultiViews = true

configuration.isEnableAppliancePlugin = true;

whiteSdk = WhiteSdk(
whiteBoardView,
context,
configuration,
whiteBoardSDKLog,
AudioMixerBridgeImpl(whiteboardMixingBridgeListener)
)
whiteSdk.setSlideListener(this);
}

fun join(config: FcrBoardRoomJoinConfig) {
Expand Down
2 changes: 2 additions & 0 deletions AgoraEduUIKit/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
<string name="fcr_user_tutor_left">外教已離開教室</string>

<!-- ****************** 白板Netless Board ****************** -->
<string name="fcr_board_slide_retry">課件加載失敗,正在重試</string>
<string name="fcr_board_slide_retry_failure">課件加載失敗,請切換下一頁或關閉課件后重新打開</string>
<string name="fcr_netless_board_granted">你已被老師授權,請使用白板工具互動</string>
<string name="fcr_netless_board_ungranted">你已被老師收回授權,無法使用白板工具互動</string>

Expand Down
2 changes: 2 additions & 0 deletions AgoraEduUIKit/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
<string name="fcr_user_tutor_left">外教已离开教室</string>

<!-- ****************** 白板Netless Board ****************** -->
<string name="fcr_board_slide_retry">课件加载失败,正在重试</string>
<string name="fcr_board_slide_retry_failure">课件加载失败,请切换下一页或关闭课件后重新打开</string>
<string name="fcr_netless_board_granted">你已被老师授权,请使用白板工具互动</string>
<string name="fcr_netless_board_ungranted">你已被老师收回授权,无法使用白板工具互动</string>

Expand Down
2 changes: 2 additions & 0 deletions AgoraEduUIKit/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
<string name="fcr_user_tutor_left">The teacher has left the classroom</string>

<!-- ****************** 白板Netless Board ****************** -->
<string name="fcr_board_slide_retry">course load failure, retry now.</string>
<string name="fcr_board_slide_retry_failure">course load failure, please load next page or reopen.</string>
<string name="fcr_netless_board_granted">You can now annotate on the whiteboard.</string>
<string name="fcr_netless_board_ungranted">Your access to the whiteboard has been revoked by the teacher.</string>

Expand Down
2 changes: 1 addition & 1 deletion config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ext {
'agora_basic_sdk_rtc' : '3.7.1',
'agora_native_full_sdk_arsenal' : '4.0.0',
'agora_rtm_sdk' : '1.5.1',
'white_sdk_android' : '2.16.41',
'white_sdk_android' : '2.16.95',
'glide' : '4.11.0',
'glide_compiler' : '4.11.0',
'core_ktx' : '1.3.2',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ import java.lang.reflect.Proxy
* date : 2022/6/7
* description :
*/
class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
class FcrBoardRoom(var whiteBoardView: WhiteboardView) : SlideListener {
var whiteBoardSDKLog: FcrBoardSDKLog = FcrBoardSDKLog()
lateinit var whiteSdk: WhiteSdk
var context: Context = whiteBoardView.context
var retryTime = 0
var roomParams: RoomParams? = null
val handler = Handler(Looper.getMainLooper())
var roomListener: FcrBoardRoomListener? = null
set(value) {
whiteBoardSDKLog.roomListener = value
Expand Down Expand Up @@ -70,6 +72,7 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
configuration.isUserCursor = true
configuration.region = FcrWhiteboardConverter.convertStringToRegion(region)
configuration.useMultiViews = true
configuration.isEnableAppliancePlugin = true;

whiteSdk = WhiteSdk(
whiteBoardView,
Expand All @@ -78,6 +81,41 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
whiteBoardSDKLog,
AudioMixerBridgeImpl(whiteboardMixingBridgeListener)
)
whiteSdk.setSlideListener(this);
}

override fun onSlideError(
errorType: SlideErrorType?,
errorMsg: String?,
slideId: String?,
slideIndex: Int
) {
if (errorType == SlideErrorType.RESOURCE_ERROR || errorType == SlideErrorType.CANVAS_CRASH) {
if (this.retryTime == 0) {
this.retry(slideId!!, slideIndex)
} else if (this.retryTime < 5) {
handler.postDelayed({
this.retry(slideId!!, slideIndex)
}, 5000)
} else {
this.retryTime = 0
ContextCompat.getMainExecutor(context).execute {
ToastManager.showShort(context, R.string.fcr_board_slide_retry_failure)
}
}
} else if (errorType == SlideErrorType.RUNTIME_ERROR) {
this.whiteSdk.recoverSlide(slideId, slideIndex)
} else if(errorType == SlideErrorType.RUNTIME_WARN){
LogX.w(TAG, "slide page: ${slideIndex}, error: ${errorMsg.toString()}")
}
}

private fun retry(slideId: String, slideIndex: Int){
this.retryTime += 1
this.whiteSdk.recoverSlide(slideId, slideIndex)
ContextCompat.getMainExecutor(whiteBoardView.context).execute{
ToastManager.showShort(context.getString(R.string.fcr_board_slide_retry) + this.retryTime + "/5")
}
}

fun join(config: FcrBoardRoomJoinConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ import java.lang.reflect.Proxy
* date : 2022/6/7
* description :
*/
class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
class FcrBoardRoom(var whiteBoardView: WhiteboardView) : SlideListener {
var whiteBoardSDKLog: FcrBoardSDKLog = FcrBoardSDKLog()
lateinit var whiteSdk: WhiteSdk
var context: Context = whiteBoardView.context
var roomParams: RoomParams? = null
val TAG = "WhiteBoardSDK"
var retryTime = 0
val handler = Handler(Looper.getMainLooper())
var roomListener: FcrBoardRoomListener? = null
set(value) {
whiteBoardSDKLog.roomListener = value
Expand Down Expand Up @@ -71,6 +73,7 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
configuration.isUserCursor = true
configuration.region = FcrWhiteboardConverter.convertStringToRegion(region)
configuration.useMultiViews = true
configuration.isEnableAppliancePlugin = true;

whiteSdk = WhiteSdk(
whiteBoardView,
Expand All @@ -79,6 +82,41 @@ class FcrBoardRoom(var whiteBoardView: WhiteboardView) {
whiteBoardSDKLog,
AudioMixerBridgeImpl(whiteboardMixingBridgeListener)
)
whiteSdk.setSlideListener(this);
}

override fun onSlideError(
errorType: SlideErrorType?,
errorMsg: String?,
slideId: String?,
slideIndex: Int
) {
if (errorType == SlideErrorType.RESOURCE_ERROR || errorType == SlideErrorType.CANVAS_CRASH) {
if (this.retryTime == 0) {
this.retry(slideId!!, slideIndex)
} else if (this.retryTime < 5) {
handler.postDelayed({
this.retry(slideId!!, slideIndex)
}, 5000)
} else {
this.retryTime = 0
ContextCompat.getMainExecutor(context).execute {
ToastManager.showShort(context, R.string.fcr_board_slide_retry_failure)
}
}
} else if (errorType == SlideErrorType.RUNTIME_ERROR) {
this.whiteSdk.recoverSlide(slideId, slideIndex)
} else if(errorType == SlideErrorType.RUNTIME_WARN){
LogX.w(TAG, "slide page: ${slideIndex}, error: ${errorMsg.toString()}")
}
}

private fun retry(slideId: String, slideIndex: Int){
this.retryTime += 1
this.whiteSdk.recoverSlide(slideId, slideIndex)
ContextCompat.getMainExecutor(whiteBoardView.context).execute{
ToastManager.showShort(context.getString(R.string.fcr_board_slide_retry) + this.retryTime + "/5")
}
}

fun join(config: FcrBoardRoomJoinConfig) {
Expand Down
2 changes: 1 addition & 1 deletion open-cloudclass-android/config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ext {
'agora_basic_sdk_rtc' : '3.7.1',
'agora_native_full_sdk_arsenal' : '4.0.0',
'agora_rtm_sdk' : '1.5.1',
'white_sdk_android' : '2.16.41',
'white_sdk_android' : '2.16.93',
'glide' : '4.11.0',
'glide_compiler' : '4.11.0',
'core_ktx' : '1.3.2',
Expand Down