Commit 3d6e551e by 刘鹏

feat: 声网日志埋点完成

parent 3507c44d
...@@ -47,6 +47,8 @@ import com.ydl.ydlcommon.utils.LogUtil ...@@ -47,6 +47,8 @@ import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.StatusBarUtils import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunLogHelper
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
...@@ -137,7 +139,7 @@ class ConsultantAudioHomeActivity : ...@@ -137,7 +139,7 @@ class ConsultantAudioHomeActivity :
super.onJoinChannelSuccess(channel, uid, elapsed) super.onJoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 加入频道回调") LogUtil.e("[agora]$uid 加入频道回调")
writeAgoraLog("被叫(用户)加入声网($channel)频道成功") writeAgoraLog("被叫(用户)加入声网($channel)频道成功")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "被叫(用户)加入声网($channel)频道成功")
runOnUiThread { runOnUiThread {
// 加入频道后再通知用户已接受 // 加入频道后再通知用户已接受
// YDLRTMClient.instances.acceptCall(mAudioMessageBean?.channelId) // YDLRTMClient.instances.acceptCall(mAudioMessageBean?.channelId)
...@@ -165,6 +167,9 @@ class ConsultantAudioHomeActivity : ...@@ -165,6 +167,9 @@ class ConsultantAudioHomeActivity :
super.onRejoinChannelSuccess(channel, uid, elapsed) super.onRejoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 重新加入频道回调") LogUtil.e("[agora]$uid 重新加入频道回调")
writeAgoraLog("被叫(用户)重新加入声网频道($channel)成功") writeAgoraLog("被叫(用户)重新加入声网频道($channel)成功")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "被叫(用户)重新加入声网频道($channel)成功")
runOnUiThread { runOnUiThread {
if (!isConnectSuccess) { if (!isConnectSuccess) {
tv_toast.visibility = View.VISIBLE tv_toast.visibility = View.VISIBLE
...@@ -182,6 +187,8 @@ class ConsultantAudioHomeActivity : ...@@ -182,6 +187,8 @@ class ConsultantAudioHomeActivity :
super.onUserJoined(uid, elapsed) super.onUserJoined(uid, elapsed)
LogUtil.e("[agora]远端用户加入频道回调") LogUtil.e("[agora]远端用户加入频道回调")
writeAgoraLog("主叫(专家)加入声网频道成功") writeAgoraLog("主叫(专家)加入声网频道成功")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "主叫(专家)加入声网频道成功")
//另一方加入频道成功 //另一方加入频道成功
runOnUiThread { runOnUiThread {
isConnectSuccess = true isConnectSuccess = true
...@@ -223,6 +230,8 @@ class ConsultantAudioHomeActivity : ...@@ -223,6 +230,8 @@ class ConsultantAudioHomeActivity :
override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) { override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) {
super.onLeaveChannel(stats) super.onLeaveChannel(stats)
LogUtil.e("[agora]自己离开频道回调") LogUtil.e("[agora]自己离开频道回调")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "自己离开频道回调")
//通知php 通话已结束 //通知php 通话已结束
close(RESULT_ANSWERED_CODE, "") close(RESULT_ANSWERED_CODE, "")
} }
...@@ -241,6 +250,8 @@ class ConsultantAudioHomeActivity : ...@@ -241,6 +250,8 @@ class ConsultantAudioHomeActivity :
override fun onUserOffline(uid: Int, elapsed: Int) { override fun onUserOffline(uid: Int, elapsed: Int) {
super.onUserOffline(uid, elapsed) super.onUserOffline(uid, elapsed)
LogUtil.e("[agora]$uid 主播离开频道回调") LogUtil.e("[agora]$uid 主播离开频道回调")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "$uid 主播离开频道回调")
runOnUiThread { runOnUiThread {
YDLavManager.instances.callEndStatusUpdate( YDLavManager.instances.callEndStatusUpdate(
mAudioMessageBean?.channelId!!, mAudioMessageBean?.channelId!!,
...@@ -249,6 +260,8 @@ class ConsultantAudioHomeActivity : ...@@ -249,6 +260,8 @@ class ConsultantAudioHomeActivity :
) )
showToast("对方已挂断") showToast("对方已挂断")
writeAgoraLog("通话接通后挂断:主叫(专家)离开频道") writeAgoraLog("通话接通后挂断:主叫(专家)离开频道")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "通话接通后挂断:主叫(专家)离开频道")
if (null != totalDisposable) { if (null != totalDisposable) {
totalDisposable!!.dispose() totalDisposable!!.dispose()
} }
...@@ -265,6 +278,8 @@ class ConsultantAudioHomeActivity : ...@@ -265,6 +278,8 @@ class ConsultantAudioHomeActivity :
} }
LogUtil.e("[agora]发生警告回调=$warn") LogUtil.e("[agora]发生警告回调=$warn")
writeAgoraLog("声网警告回调码:($warn)") writeAgoraLog("声网警告回调码:($warn)")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "声网警告回调码:($warn)")
//103:没有可用的频道资源。可能是因为服务端没法分配频道资源 //103:没有可用的频道资源。可能是因为服务端没法分配频道资源
//104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器 //104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器
//105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的 //105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的
...@@ -290,6 +305,7 @@ class ConsultantAudioHomeActivity : ...@@ -290,6 +305,7 @@ class ConsultantAudioHomeActivity :
uploadException("mRtcEventHandler-onError:errorCode--%${err}") uploadException("mRtcEventHandler-onError:errorCode--%${err}")
LogUtil.e("[agora] 发生错误回调 =$err") LogUtil.e("[agora] 发生错误回调 =$err")
writeAgoraLog("声网错误回调errorCode--%${err}") writeAgoraLog("声网错误回调errorCode--%${err}")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "声网错误回调errorCode--%${err}")
//3:SDK 初始化失败。Agora 建议尝试以下处理方法 //3:SDK 初始化失败。Agora 建议尝试以下处理方法
//7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化 //7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化
...@@ -510,6 +526,8 @@ class ConsultantAudioHomeActivity : ...@@ -510,6 +526,8 @@ class ConsultantAudioHomeActivity :
override fun channelTokenResponse(token: String?, needJoinChannel: Boolean) { override fun channelTokenResponse(token: String?, needJoinChannel: Boolean) {
if (TextUtils.isEmpty(token)) { if (TextUtils.isEmpty(token)) {
LogUtil.e("[agora]token not null") LogUtil.e("[agora]token not null")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "token isEmpty ")
showToast("通话频道不存在") showToast("通话频道不存在")
finish() finish()
return return
...@@ -583,6 +601,8 @@ class ConsultantAudioHomeActivity : ...@@ -583,6 +601,8 @@ class ConsultantAudioHomeActivity :
val account = YdlCommonRouterManager.getYdlCommonRoute().getUid() val account = YdlCommonRouterManager.getYdlCommonRoute().getUid()
if (!TextUtils.isEmpty(mAudioMessageBean?.channelId)) { if (!TextUtils.isEmpty(mAudioMessageBean?.channelId)) {
LogUtil.e("[agora] joinChannel:$account") LogUtil.e("[agora] joinChannel:$account")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "joinChannel:$account")
voiceManage?.getVoiceApi()?.joinChannel( voiceManage?.getVoiceApi()?.joinChannel(
channelToken channelToken
?: "", mAudioMessageBean!!.channelId!!, "Extra Optional Data", account ?: "", mAudioMessageBean!!.channelId!!, "Extra Optional Data", account
...@@ -807,6 +827,9 @@ class ConsultantAudioHomeActivity : ...@@ -807,6 +827,9 @@ class ConsultantAudioHomeActivity :
fun close(code: Int, msg: String) { fun close(code: Int, msg: String) {
runOnUiThread { runOnUiThread {
LogUtil.e("[agora]close(code:$code,msg:$msg)") LogUtil.e("[agora]close(code:$code,msg:$msg)")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "close(code:$code,msg:$msg)")
//上传日志文件 //上传日志文件
uploadLog() uploadLog()
stopMusic() stopMusic()
...@@ -837,6 +860,7 @@ class ConsultantAudioHomeActivity : ...@@ -837,6 +860,7 @@ class ConsultantAudioHomeActivity :
} }
ActivityManager.getInstance().removeStack(activity = this) ActivityManager.getInstance().removeStack(activity = this)
LogUtil.e("[agora]页面移除") LogUtil.e("[agora]页面移除")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "页面移除")
finish() finish()
} }
} }
...@@ -945,9 +969,11 @@ class ConsultantAudioHomeActivity : ...@@ -945,9 +969,11 @@ class ConsultantAudioHomeActivity :
Observable.create<Any> { Observable.create<Any> {
try { try {
AudioLogUtils.writeAgoraLog( AudioLogUtils.writeAgoraLog(
"$content-------Time:${AudioLogUtils.format.format( "$content-------Time:${
Calendar.getInstance().time AudioLogUtils.format.format(
)}", "consult.log" Calendar.getInstance().time
)
}", "consult.log"
) )
} catch (e: Exception) { } catch (e: Exception) {
} }
......
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