Commit b58105fb by ydl

手动切换axb之前,如果声网是连接成功状态,调用上传异常接口108,成功之后,才能调用dial接口切换axb,如果未连接成功,则走原逻辑

parent 44c7d0a2
......@@ -181,7 +181,7 @@ class AudioHomeActivity :
override fun onWarning(warn: Int) {
super.onWarning(warn)
uploadException("mRtcEventHandler-onWarning:warnCode--%${warn}")
uploadException("mRtcEventHandler-onWarning:warnCode--%${warn}", callback = null)
//103:没有可用的频道资源。可能是因为服务端没法分配频道资源
//104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器
//105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的
......@@ -203,7 +203,7 @@ class AudioHomeActivity :
override fun onError(err: Int) {
super.onError(err)
uploadException("mRtcEventHandler-onError:errorCode--%${err}")
uploadException("mRtcEventHandler-onError:errorCode--%${err}", callback = null)
uploadLog()
//3:SDK 初始化失败。Agora 建议尝试以下处理方法
//7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化
......@@ -700,7 +700,16 @@ class AudioHomeActivity :
* 切换成axb路线请求
*/
private fun switchAXB() {
mPresenter.getAXBPhone(ConnectCommand(listenId!!, "1"))
if (isConnectSuccess) {
uploadException("", "zhu", "108", object : YDLavManager.UploadExceptionCallback {
override fun onSuccess() {
mPresenter.getAXBPhone(ConnectCommand(listenId!!, "1"))
}
})
} else {
mPresenter.getAXBPhone(ConnectCommand(listenId!!, "1"))
}
}
/**
......@@ -1082,12 +1091,12 @@ class AudioHomeActivity :
* 上传错误日志
* zhu 洪平要的,判别是移动端主动调的还是声网返的
*/
private fun uploadException(message: String, zhu: String = "", eventType: String = "99") {
private fun uploadException(message: String, zhu: String = "", eventType: String = "99", callback: YDLavManager.UploadExceptionCallback?) {
var time: String = (System.currentTimeMillis() / 1000).toString()
var uid: String = ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid!!
var payLoad = PayLoad(channelId ?: "0", time, uid, "1", "999", message)
var connectException = ConnectExceptionCommand(time + zhu, "2", eventType, payLoad)
YDLavManager.instances.uploadException(connectException)
YDLavManager.instances.uploadException(connectException, callback)
}
......@@ -1106,7 +1115,7 @@ class AudioHomeActivity :
override fun onDestroy() {
super.onDestroy()
if (isConnectSuccess) {
uploadException("", "zhu", "108")
uploadException("", "zhu", "108", callback = null)
}
if (handler != null) {
handler = null
......
......@@ -317,18 +317,26 @@ class YDLavManager {
* 声网出现异常,上传错误日志 connectException
*/
@SuppressLint("CheckResult")
fun uploadException(connectException: ConnectExceptionCommand) {
fun uploadException(connectException: ConnectExceptionCommand, callback: UploadExceptionCallback?) {
AudioApiRequestUtil.connectException(connectException)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
callback?.onSuccess()
}, {
LogUtil.e("agora", "声网上传异常与错误日志接口调用失败:" + it.message)
})
}
/**
* 上传异常错误回调
*/
interface UploadExceptionCallback {
fun onSuccess()
}
/**
* 实时消息全局监听
*/
private val listener = object : InitListener {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment