Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
68c46651
Commit
68c46651
authored
Apr 01, 2021
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 云信埋点完成
parent
81ae4930
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
159 additions
and
20 deletions
+159
-20
config.gradle
config.gradle
+2
-2
AVChatKit.java
m-im/src/main/java/com/yidianling/avchatkit/AVChatKit.java
+5
-1
AVChatActivity.java
m-im/src/main/java/com/yidianling/avchatkit/activity/AVChatActivity.java
+57
-2
AVChatBaseUI.java
m-im/src/main/java/com/yidianling/avchatkit/common/activity/AVChatBaseUI.java
+1
-0
CustomAlertDialog.java
m-im/src/main/java/com/yidianling/avchatkit/common/dialog/CustomAlertDialog.java
+1
-0
NetworkUtil.java
m-im/src/main/java/com/yidianling/avchatkit/common/util/NetworkUtil.java
+8
-2
AVChatController.java
m-im/src/main/java/com/yidianling/avchatkit/controll/AVChatController.java
+65
-10
TeamAVChatActivity.java
m-im/src/main/java/com/yidianling/avchatkit/teamavchat/activity/TeamAVChatActivity.java
+9
-0
IMChatUtil.kt
m-im/src/main/java/com/yidianling/im/helper/IMChatUtil.kt
+8
-3
NimUIKit.java
m-im/src/main/java/com/yidianling/uikit/api/NimUIKit.java
+3
-0
No files found.
config.gradle
View file @
68c46651
...
...
@@ -10,7 +10,7 @@ ext {
"m-fm"
:
"0.0.30.01"
,
"m-user"
:
"0.0.61.18"
,
"m-home"
:
"0.0.22.55"
,
"m-im"
:
"0.0.18.4
1
"
,
"m-im"
:
"0.0.18.4
5
"
,
"m-dynamic"
:
"0.0.7.19"
,
"m-article"
:
"0.0.0.6"
,
...
...
@@ -93,7 +93,7 @@ ext {
"m-fm"
:
"0.0.30.01"
,
"m-user"
:
"0.0.61.18"
,
"m-home"
:
"0.0.22.54"
,
"m-im"
:
"0.0.18.4
0
"
,
"m-im"
:
"0.0.18.4
5
"
,
"m-dynamic"
:
"0.0.7.19"
,
"m-article"
:
"0.0.0.6"
,
...
...
m-im/src/main/java/com/yidianling/avchatkit/AVChatKit.java
View file @
68c46651
...
...
@@ -10,6 +10,8 @@ import com.netease.nimlib.sdk.avchat.AVChatManager;
import
com.netease.nimlib.sdk.avchat.constant.AVChatControlCommand
;
import
com.netease.nimlib.sdk.avchat.model.AVChatData
;
import
com.ydl.ydlcommon.base.BaseActivityMgr
;
import
com.ydl.ydlnet.utils.log.AliYunLogConfig
;
import
com.ydl.ydlnet.utils.log.AliYunLogHelper
;
import
com.yidianling.avchatkit.activity.AVChatActivity
;
import
com.yidianling.avchatkit.common.log.ILogUtil
;
import
com.yidianling.avchatkit.common.log.LogUtil
;
...
...
@@ -149,6 +151,8 @@ public class AVChatKit {
*/
public
static
void
outgoingCall
(
Context
context
,
String
account
,
String
displayName
,
int
callType
,
int
source
)
{
AVChatActivity
.
outgoingCall
(
context
,
account
,
displayName
,
callType
,
source
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"outgoingCall 发起音视频通话呼叫"
);
}
/**
...
...
@@ -162,7 +166,7 @@ public class AVChatKit {
*/
public
static
void
outgoingTeamCall
(
Context
context
,
boolean
receivedCall
,
String
teamId
,
String
roomId
,
ArrayList
<
String
>
accounts
,
String
teamName
)
{
TeamAVChatActivity
.
startActivity
(
context
,
receivedCall
,
teamId
,
roomId
,
accounts
,
teamName
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"outgoingTeamCall 发起群组音视频通话呼叫"
);
}
/**
...
...
m-im/src/main/java/com/yidianling/avchatkit/activity/AVChatActivity.java
View file @
68c46651
...
...
@@ -26,6 +26,8 @@ import com.netease.nimlib.sdk.avchat.model.AVChatData;
import
com.netease.nimlib.sdk.avchat.model.AVChatOnlineAckEvent
;
import
com.netease.nimlib.sdk.avchat.model.AVChatVideoFrame
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.ydl.ydlnet.utils.log.AliYunLogConfig
;
import
com.ydl.ydlnet.utils.log.AliYunLogHelper
;
import
com.yidianling.avchatkit.AVChatKit
;
import
com.yidianling.avchatkit.AVChatProfile
;
import
com.yidianling.avchatkit.common.activity.AVChatBaseUI
;
...
...
@@ -325,6 +327,7 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
ToastUtil
.
toastShort
(
AVChatActivity
.
this
,
msg
);
}
else
{
ToastUtil
.
toastShort
(
AVChatActivity
.
this
,
"录制已结束."
);
}
if
(
state
==
AVChatType
.
AUDIO
.
getValue
())
{
avChatAudioUI
.
resetRecordTip
();
...
...
@@ -345,12 +348,17 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
@Override
public
void
onJoinedChannel
(
int
code
,
String
audioFile
,
String
videoFile
,
int
i
)
{
LogUtil
.
d
(
TAG
,
"audioFile -> "
+
audioFile
+
" videoFile -> "
+
videoFile
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"audioFile -> "
+
audioFile
+
" videoFile -> "
+
videoFile
);
handleWithConnectServerResult
(
code
);
}
@Override
public
void
onUserJoined
(
String
account
)
{
LogUtil
.
d
(
TAG
,
"onUserJoin -> "
+
account
);
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onUserJoin -> "
+
account
);
if
(
state
==
AVChatType
.
VIDEO
.
getValue
())
{
avChatVideoUI
.
initLargeSurfaceView
(
account
);
}
...
...
@@ -359,6 +367,9 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
@Override
public
void
onUserLeave
(
String
account
,
int
event
)
{
LogUtil
.
d
(
TAG
,
"onUserLeave -> "
+
account
);
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onUserLeave -> "
+
account
);
manualHangUp
(
AVChatExitCode
.
HANGUP
);
finish
();
}
...
...
@@ -366,11 +377,14 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
@Override
public
void
onCallEstablished
()
{
LogUtil
.
d
(
TAG
,
"onCallEstablished"
);
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onCallEstablished"
);
//移除超时监听
AVChatTimeoutObserver
.
getInstance
().
observeTimeoutNotification
(
timeoutObserver
,
false
,
mIsInComingCall
);
if
(
avChatController
.
getTimeBase
()
==
0
)
if
(
avChatController
.
getTimeBase
()
==
0
)
{
avChatController
.
setTimeBase
(
SystemClock
.
elapsedRealtime
());
}
if
(
state
==
AVChatType
.
AUDIO
.
getValue
())
{
avChatAudioUI
.
showAudioInitLayout
();
}
else
{
...
...
@@ -400,6 +414,9 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
public
void
onEvent
(
AVChatCommonEvent
avChatHangUpInfo
)
{
avChatData
=
avChatController
.
getAvChatData
();
if
(
avChatData
!=
null
&&
avChatData
.
getChatId
()
==
avChatHangUpInfo
.
getChatId
())
{
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"callHangupObserver 通话过程中,收到对方挂断电话"
);
hangUpByOther
(
AVChatExitCode
.
HANGUP
);
cancelCallingNotifier
();
// 如果是incoming call主叫方挂断,那么通知栏有通知
...
...
@@ -418,10 +435,16 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
AVChatData
info
=
avChatController
.
getAvChatData
();
if
(
info
!=
null
&&
info
.
getChatId
()
==
ackInfo
.
getChatId
())
{
if
(
ackInfo
.
getEvent
()
==
AVChatEventType
.
CALLEE_ACK_BUSY
)
{
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"callAckObserver 呼叫时,被叫方正在忙"
);
hangUpByOther
(
AVChatExitCode
.
PEER_BUSY
);
}
else
if
(
ackInfo
.
getEvent
()
==
AVChatEventType
.
CALLEE_ACK_REJECT
)
{
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"callAckObserver 呼叫时,被叫方拒绝通话"
);
hangUpByOther
(
AVChatExitCode
.
REJECT
);
}
else
if
(
ackInfo
.
getEvent
()
==
AVChatEventType
.
CALLEE_ACK_AGREE
)
{
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"callAckObserver 呼叫时,被叫方同意通话"
);
AVChatSoundPlayer
.
instance
().
stop
();
avChatController
.
isCallEstablish
.
set
(
true
);
}
...
...
@@ -436,6 +459,8 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
// 来电超时,自己未接听
if
(
mIsInComingCall
)
{
activeMissCallNotifier
();
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"timeoutObserver 来电超时,自己未接听"
);
}
finish
();
}
...
...
@@ -456,27 +481,39 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
}
switch
(
notification
.
getControlCommand
())
{
case
AVChatControlCommand
.
SWITCH_AUDIO_TO_VIDEO
:
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleCallControl 音频切换到视频"
);
incomingAudioToVideo
();
break
;
case
AVChatControlCommand
.
SWITCH_AUDIO_TO_VIDEO_AGREE
:
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleCallControl 同意从音频切换到视频"
);
// 对方同意切成视频啦
state
=
AVChatType
.
VIDEO
.
getValue
();
avChatVideoUI
.
onAudioToVideoAgree
(
notification
.
getAccount
());
break
;
case
AVChatControlCommand
.
SWITCH_AUDIO_TO_VIDEO_REJECT
:
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleCallControl 拒绝从音频切换到视频"
);
rejectAudioToVideo
();
ToastUtil
.
toastShort
(
AVChatActivity
.
this
,
R
.
string
.
im_avchat_switch_video_reject
);
break
;
case
AVChatControlCommand
.
SWITCH_VIDEO_TO_AUDIO
:
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleCallControl 视频切换到音频"
);
onVideoToAudio
();
break
;
case
AVChatControlCommand
.
NOTIFY_VIDEO_OFF
:
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleCallControl 通知对方自己关闭了视频"
);
// 收到对方关闭画面通知
if
(
state
==
AVChatType
.
VIDEO
.
getValue
())
{
avChatVideoUI
.
peerVideoOff
();
}
break
;
case
AVChatControlCommand
.
NOTIFY_VIDEO_ON
:
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleCallControl 通知对方自己打开了视频"
);
// 收到对方打开画面通知
if
(
state
==
AVChatType
.
VIDEO
.
getValue
())
{
avChatVideoUI
.
peerVideoOn
();
...
...
@@ -496,14 +533,24 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
protected
void
handleWithConnectServerResult
(
int
auth_result
)
{
LogUtil
.
i
(
TAG
,
"result code->"
+
auth_result
);
if
(
auth_result
==
200
)
{
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleWithConnectServerResult onConnectServer success"
);
LogUtil
.
d
(
TAG
,
"onConnectServer success"
);
}
else
if
(
auth_result
==
101
)
{
// 连接超时
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleWithConnectServerResult 连接超时 101"
);
avChatController
.
showQuitToast
(
AVChatExitCode
.
PEER_NO_RESPONSE
);
}
else
if
(
auth_result
==
401
)
{
// 验证失败
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleWithConnectServerResult 验证失败 401"
);
avChatController
.
showQuitToast
(
AVChatExitCode
.
CONFIG_ERROR
);
}
else
if
(
auth_result
==
417
)
{
// 无效的channelId
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleWithConnectServerResult 无效的channelId 417"
);
avChatController
.
showQuitToast
(
AVChatExitCode
.
INVALIDE_CHANNELID
);
}
else
{
// 连接服务器错误,直接退出
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"handleWithConnectServerResult 连接服务器错误"
+
auth_result
);
avChatController
.
showQuitToast
(
AVChatExitCode
.
CONFIG_ERROR
);
}
}
...
...
@@ -545,6 +592,8 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
if
(
client
!=
null
)
{
String
option
=
ackInfo
.
getEvent
()
==
AVChatEventType
.
CALLEE_ONLINE_CLIENT_ACK_AGREE
?
"接听!"
:
"拒绝!"
;
ToastUtil
.
toastShort
(
AVChatActivity
.
this
,
"通话已在"
+
client
+
"端被"
+
option
);
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onlineAckObserver 通话已在"
+
client
+
"端被"
+
option
);
}
finish
();
}
...
...
@@ -607,6 +656,8 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
@Override
public
void
onReceiveAudioToVideoAgree
()
{
// 同意切换为视频
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onReceiveAudioToVideoAgree 同意切换为视频"
);
state
=
AVChatType
.
VIDEO
.
getValue
();
audioRoot
.
setVisibility
(
View
.
GONE
);
videoRoot
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -663,12 +714,16 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
// 主动挂断
private
void
manualHangUp
(
int
exitCode
)
{
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"manualHangUp 主动挂断"
);
releaseVideo
();
avChatController
.
hangUp
(
exitCode
);
}
// 被对方挂断
private
void
hangUpByOther
(
int
exitCode
)
{
AliYunLogHelper
.
Companion
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"hangUpByOther 被对方挂断 exitCode:"
+
exitCode
);
if
(
exitCode
==
AVChatExitCode
.
PEER_BUSY
)
{
avChatController
.
hangUp
(
AVChatExitCode
.
HANGUP
);
finish
();
...
...
m-im/src/main/java/com/yidianling/avchatkit/common/activity/AVChatBaseUI.java
View file @
68c46651
...
...
@@ -35,6 +35,7 @@ public abstract class AVChatBaseUI extends AppCompatActivity {
super
.
onStart
();
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
m-im/src/main/java/com/yidianling/avchatkit/common/dialog/CustomAlertDialog.java
View file @
68c46651
...
...
@@ -157,6 +157,7 @@ public class CustomAlertDialog extends AlertDialog {
}
}
@Override
public
void
setTitle
(
int
resId
)
{
this
.
title
=
context
.
getString
(
resId
);
isTitleVisible
=
TextUtils
.
isEmpty
(
title
)
?
false
:
true
;
...
...
m-im/src/main/java/com/yidianling/avchatkit/common/util/NetworkUtil.java
View file @
68c46651
...
...
@@ -11,6 +11,8 @@ import android.os.Build;
import
android.telephony.TelephonyManager
;
import
android.text.TextUtils
;
import
com.ydl.ydlnet.utils.log.AliYunLogConfig
;
import
com.ydl.ydlnet.utils.log.AliYunLogHelper
;
import
com.yidianling.avchatkit.common.log.LogUtil
;
public
class
NetworkUtil
{
...
...
@@ -79,9 +81,10 @@ public class NetworkUtil {
NetworkInfo
networkInfo
=
getActiveNetworkInfo
(
context
);
if
(
networkInfo
==
null
)
{
return
-
1
;
}
else
}
else
{
return
networkInfo
.
getType
();
}
}
/**
...
...
@@ -145,7 +148,7 @@ public class NetworkUtil {
}
}
curNetworkType
=
type
;
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
NETSTATUS
,
"网络类型:"
+
type
);
return
type
;
}
...
...
@@ -271,8 +274,11 @@ public class NetworkUtil {
NetworkInfo
ni
=
cm
.
getActiveNetworkInfo
();
if
(
ni
!=
null
)
{
if
(
ni
.
getType
()
==
ConnectivityManager
.
TYPE_WIFI
)
{
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
NETSTATUS
,
"网络类型:TYPE_WIFI"
);
return
true
;
}
else
{
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
NETSTATUS
,
"网络类型:非WIFI环境"
);
return
false
;
}
}
else
{
...
...
m-im/src/main/java/com/yidianling/avchatkit/controll/AVChatController.java
View file @
68c46651
...
...
@@ -15,6 +15,8 @@ import com.netease.nimlib.sdk.avchat.model.AVChatNotifyOption;
import
com.netease.nimlib.sdk.avchat.model.AVChatParameters
;
import
com.netease.nimlib.sdk.avchat.video.AVChatCameraCapturer
;
import
com.netease.nimlib.sdk.avchat.video.AVChatVideoCapturerFactory
;
import
com.ydl.ydlnet.utils.log.AliYunLogConfig
;
import
com.ydl.ydlnet.utils.log.AliYunLogHelper
;
import
com.yidianling.avchatkit.AVChatKit
;
import
com.yidianling.avchatkit.common.log.LogUtil
;
import
com.yidianling.avchatkit.common.widgets.MultiSelectDialog
;
...
...
@@ -70,8 +72,11 @@ public class AVChatController {
this
.
avChatConfigs
=
new
AVChatConfigs
(
context
);
}
//恢复视频和语音发送
/**
* 恢复视频和语音发送
*/
public
void
resumeVideo
()
{
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"恢复视频和语音发送"
);
if
(
needRestoreLocalVideo
)
{
AVChatManager
.
getInstance
().
muteLocalVideo
(
false
);
needRestoreLocalVideo
=
false
;
...
...
@@ -84,9 +89,11 @@ public class AVChatController {
}
//关闭视频和语音发送.
/**
* 关闭视频和语音发送.
*/
public
void
pauseVideo
()
{
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"关闭视频和语音发送"
);
if
(!
AVChatManager
.
getInstance
().
isLocalVideoMuted
())
{
AVChatManager
.
getInstance
().
muteLocalVideo
(
true
);
needRestoreLocalVideo
=
true
;
...
...
@@ -137,8 +144,10 @@ public class AVChatController {
if
(
code
==
ResponseCode
.
RES_FORBIDDEN
)
{
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_no_permission
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onFailed 暂无权限,请开通音视频服务 code:"
+
code
);
}
else
{
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_call_failed
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onFailed 发起通话失败 code:"
+
code
);
}
closeRtc
(
avChatType
==
AVChatType
.
VIDEO
?
CallStateEnum
.
VIDEO
:
CallStateEnum
.
AUDIO
);
callback
.
onFailed
(
code
,
""
);
...
...
@@ -147,6 +156,8 @@ public class AVChatController {
@Override
public
void
onException
(
Throwable
exception
)
{
LogUtil
.
d
(
TAG
,
"avChat call onException->"
+
exception
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onException avChat call onException->"
+
exception
);
closeRtc
(
avChatType
==
AVChatType
.
VIDEO
?
CallStateEnum
.
VIDEO
:
CallStateEnum
.
AUDIO
);
callback
.
onFailed
(-
1
,
exception
.
toString
());
}
...
...
@@ -184,8 +195,12 @@ public class AVChatController {
public
void
onFailed
(
int
code
)
{
if
(
code
==
-
1
)
{
ToastUtil
.
toastShort
(
context
,
"本地音视频启动失败"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onFailed 本地音视频启动失败 code:"
+
code
);
}
else
{
ToastUtil
.
toastShort
(
context
,
"建立连接失败"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onFailed 建立连接失败 code:"
+
code
);
}
LogUtil
.
e
(
TAG
,
"accept onFailed->"
+
code
);
handleAcceptFailed
(
avChatType
==
AVChatType
.
VIDEO
?
...
...
@@ -196,6 +211,8 @@ public class AVChatController {
@Override
public
void
onException
(
Throwable
exception
)
{
LogUtil
.
d
(
TAG
,
"accept exception->"
+
exception
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onException accept exception->"
+
exception
);
handleAcceptFailed
(
avChatType
==
AVChatType
.
VIDEO
?
CallStateEnum
.
VIDEO_CONNECTING
:
CallStateEnum
.
AUDIO
);
callback
.
onFailed
(-
1
,
exception
.
toString
());
...
...
@@ -208,9 +225,13 @@ public class AVChatController {
if
(!
AVChatManager
.
getInstance
().
isLocalAudioMuted
())
{
// isMute是否处于静音状态
// 关闭音频
AVChatManager
.
getInstance
().
muteLocalAudio
(
true
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"toggleMute 关闭音频"
);
}
else
{
// 打开音频
AVChatManager
.
getInstance
().
muteLocalAudio
(
false
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"toggleMute 打开音频"
);
}
}
...
...
@@ -224,6 +245,8 @@ public class AVChatController {
@Override
public
void
onSuccess
(
Void
aVoid
)
{
LogUtil
.
d
(
TAG
,
"videoSwitchAudio onSuccess"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送视频切换为音频命令 onSuccess"
);
//关闭视频
AVChatManager
.
getInstance
().
stopVideoPreview
();
AVChatManager
.
getInstance
().
disableVideo
();
...
...
@@ -235,11 +258,15 @@ public class AVChatController {
@Override
public
void
onFailed
(
int
code
)
{
LogUtil
.
d
(
TAG
,
"videoSwitchAudio onFailed"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送视频切换为音频命令 onFailed code:"
+
code
);
}
@Override
public
void
onException
(
Throwable
exception
)
{
LogUtil
.
d
(
TAG
,
"videoSwitchAudio onException"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送视频切换为音频命令 onException exception:"
+
exception
);
}
});
}
...
...
@@ -250,17 +277,23 @@ public class AVChatController {
@Override
public
void
onSuccess
(
Void
aVoid
)
{
LogUtil
.
d
(
TAG
,
"requestSwitchToVideo onSuccess"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送音频切换为视频命令 onSuccess"
);
avSwitchListener
.
onAudioToVideo
();
}
@Override
public
void
onFailed
(
int
code
)
{
LogUtil
.
d
(
TAG
,
"requestSwitchToVideo onFailed"
+
code
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送音频切换为视频命令 onFailed:"
+
code
);
}
@Override
public
void
onException
(
Throwable
exception
)
{
LogUtil
.
d
(
TAG
,
"requestSwitchToVideo onException"
+
exception
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送音频切换为视频命令 onException:"
+
exception
);
}
});
}
...
...
@@ -271,6 +304,7 @@ public class AVChatController {
@Override
public
void
onSuccess
(
Void
aVoid
)
{
LogUtil
.
d
(
TAG
,
"receiveAudioToVideo onSuccess"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送同意从音频切换为视频的命令 onSuccess"
);
avSwitchListener
.
onReceiveAudioToVideoAgree
();
}
...
...
@@ -278,11 +312,16 @@ public class AVChatController {
@Override
public
void
onFailed
(
int
code
)
{
LogUtil
.
d
(
TAG
,
"receiveAudioToVideo onFailed"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送同意从音频切换为视频的命令 onFailed:"
+
code
);
}
@Override
public
void
onException
(
Throwable
exception
)
{
LogUtil
.
d
(
TAG
,
"receiveAudioToVideo onException"
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"switchVideoToAudio 发送同意从音频切换为视频的命令 exception:"
+
exception
);
}
});
}
...
...
@@ -361,12 +400,16 @@ public class AVChatController {
}
}
// 设置扬声器是否开启
/**
* 设置扬声器是否开启
*/
public
void
toggleSpeaker
()
{
AVChatManager
.
getInstance
().
setSpeaker
(!
AVChatManager
.
getInstance
().
speakerEnabled
());
}
// 切换摄像头(主要用于前置和后置摄像头切换)
/**
* 切换摄像头(主要用于前置和后置摄像头切换)
*/
public
void
switchCamera
()
{
mVideoCapturer
.
switchCamera
();
}
...
...
@@ -403,7 +446,7 @@ public class AVChatController {
showQuitToast
(
type
);
}
/
/ 收到挂断通知,自己的处理
/
**收到挂断通知,自己的处理*/
public
void
onHangUp
(
int
exitCode
)
{
if
(
destroyRTC
)
{
return
;
...
...
@@ -415,37 +458,49 @@ public class AVChatController {
((
Activity
)
context
).
finish
();
}
/
/ 显示退出toast
/
** 显示退出toast*/
public
void
showQuitToast
(
int
code
)
{
switch
(
code
)
{
case
AVChatExitCode
.
NET_CHANGE
:
// 网络切换
case
AVChatExitCode
.
NET_ERROR
:
// 网络异常
case
AVChatExitCode
.
CONFIG_ERROR
:
// 服务器返回数据错误
// 网络切换
case
AVChatExitCode
.
NET_CHANGE
:
// 网络异常
case
AVChatExitCode
.
NET_ERROR
:
// 服务器返回数据错误
case
AVChatExitCode
.
CONFIG_ERROR
:
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_net_error_then_quit
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"网络异常,通话结束 网络切换4 网络异常8 服务器返回数据错误10 code:"
+
code
);
break
;
case
AVChatExitCode
.
REJECT
:
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_call_reject
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"被对方拒绝"
);
break
;
case
AVChatExitCode
.
PEER_HANGUP
:
case
AVChatExitCode
.
HANGUP
:
if
(
isCallEstablish
.
get
())
{
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_call_finish
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"通话结束"
);
}
break
;
case
AVChatExitCode
.
PEER_BUSY
:
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_peer_busy
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"对方正在通话中,请稍后再拨。"
);
break
;
case
AVChatExitCode
.
PROTOCOL_INCOMPATIBLE_PEER_LOWER
:
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_peer_protocol_low_version
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"对方版本过低,请提示对方升"
);
break
;
case
AVChatExitCode
.
PROTOCOL_INCOMPATIBLE_SELF_LOWER
:
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_local_protocol_low_version
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"版本过低,请升级后使用"
);
break
;
case
AVChatExitCode
.
INVALIDE_CHANNELID
:
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_invalid_channel_id
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"对方已挂断"
);
break
;
case
AVChatExitCode
.
LOCAL_CALL_BUSY
:
ToastUtil
.
toastShort
(
context
,
R
.
string
.
im_avchat_local_call_busy
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"本地通话中,无法进行通话。"
);
break
;
default
:
break
;
...
...
m-im/src/main/java/com/yidianling/avchatkit/teamavchat/activity/TeamAVChatActivity.java
View file @
68c46651
...
...
@@ -35,6 +35,8 @@ import com.netease.nimlib.sdk.avchat.model.AVChatParameters;
import
com.netease.nimlib.sdk.avchat.video.AVChatCameraCapturer
;
import
com.netease.nimlib.sdk.avchat.video.AVChatVideoCapturerFactory
;
import
com.netease.nrtc.video.render.IVideoRender
;
import
com.ydl.ydlnet.utils.log.AliYunLogConfig
;
import
com.ydl.ydlnet.utils.log.AliYunLogHelper
;
import
com.yidianling.avchatkit.AVChatKit
;
import
com.yidianling.avchatkit.TeamAVChatProfile
;
import
com.yidianling.avchatkit.common.activity.AVChatBaseUI
;
...
...
@@ -436,6 +438,7 @@ public class TeamAVChatActivity extends AVChatBaseUI {
public
void
onSuccess
(
AVChatData
data
)
{
chatId
=
data
.
getChatId
();
LogUtil
.
i
(
TAG
,
"join room success, roomId="
+
roomId
+
", chatId="
+
chatId
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"join room success, roomId="
+
roomId
+
", chatId="
+
chatId
);
}
@Override
...
...
@@ -458,13 +461,17 @@ public class TeamAVChatActivity extends AVChatBaseUI {
startLocalPreview
();
startTimerForCheckReceivedCall
();
LogUtil
.
i
(
TAG
,
"team avchat running..."
+
", roomId="
+
roomId
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"onJoinRoomSuccess 进入房间成功"
);
}
private
void
onJoinRoomFailed
(
int
code
,
Throwable
e
)
{
if
(
code
==
ResponseCode
.
RES_ENONEXIST
)
{
showToast
(
getString
(
R
.
string
.
im_t_avchat_join_fail_not_exist
));
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"startRtc 进入房间失败 房间不存在 code:"
+
code
);
}
else
{
showToast
(
"join room failed, code="
+
code
+
", e="
+
(
e
==
null
?
""
:
e
.
getMessage
()));
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"join room failed, code="
+
code
+
", e="
+
(
e
==
null
?
""
:
e
.
getMessage
()));
}
}
...
...
@@ -483,6 +490,7 @@ public class TeamAVChatActivity extends AVChatBaseUI {
updateAudioMuteButtonState
();
LogUtil
.
i
(
TAG
,
"on user joined, account="
+
account
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"on user joined, account="
+
account
);
}
public
void
onAVChatUserLeave
(
String
account
)
{
...
...
@@ -496,6 +504,7 @@ public class TeamAVChatActivity extends AVChatBaseUI {
updateAudioMuteButtonState
();
LogUtil
.
i
(
TAG
,
"on user leave, account="
+
account
);
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"on user leave, account="
+
account
);
}
private
void
startLocalPreview
()
{
...
...
m-im/src/main/java/com/yidianling/im/helper/IMChatUtil.kt
View file @
68c46651
...
...
@@ -19,6 +19,8 @@ import com.ydl.ydlcommon.utils.NetworkParamsUtils
import
com.ydl.ydlcommon.utils.UserInfoCache
import
com.ydl.ydlcommon.utils.remind.HttpErrorUtils.Companion.handleError
import
com.ydl.ydlcommon.view.dialog.CommonDialog
import
com.ydl.ydlnet.utils.log.AliYunLogConfig
import
com.ydl.ydlnet.utils.log.AliYunLogHelper.Companion.getInstance
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.R
...
...
@@ -194,6 +196,7 @@ object IMChatUtil {
isFromQingShu
:
Int
,
context
:
AppCompatActivity
)
{
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"startChatSession 开启聊天会话"
)
val
p2PCustomActionHandlerImpl
=
P2PCustomActionHandlerImpl
(
toUid
,
expertInfo
)
p2PCustomActionHandlerImpl
.
isFromQingShu
=
isFromQingShu
SessionHelper
.
startP2PSession
(
...
...
@@ -278,7 +281,7 @@ object IMChatUtil {
}
else
{
upLoadLog
(
"consult/get-expert"
,
resp
.
code
,
resp
.
msg
)
if
(
resp
.
code
==
ImConstants
.
HTTP_CODE_UNLOGIN
)
{
ImIn
.
loginByOneKeyLogin
(
context
,
true
)
ImIn
.
loginByOneKeyLogin
(
context
,
true
)
ToastUtil
.
toastShort
(
resp
.
msg
)
}
else
if
(
resp
.
code
==
ImConstants
.
SILENCED_CODE
)
{
//禁言
showSilencedDialog
(
context
,
resp
.
data
.
tips
,
resp
.
data
.
url
)
...
...
@@ -326,7 +329,7 @@ object IMChatUtil {
}
else
{
upLoadLog
(
"consult/get-expert"
,
resp
.
code
,
resp
.
msg
)
if
(
resp
.
code
==
ImConstants
.
HTTP_CODE_UNLOGIN
)
{
ImIn
.
loginByOneKeyLogin
(
context
,
true
)
ImIn
.
loginByOneKeyLogin
(
context
,
true
)
ToastUtil
.
toastShort
(
resp
.
msg
)
}
else
if
(
resp
.
code
==
ImConstants
.
SILENCED_CODE
)
{
//禁言
showSilencedDialog
(
context
,
resp
.
data
.
tips
,
resp
.
data
.
url
)
...
...
@@ -367,7 +370,9 @@ object IMChatUtil {
tb
.
setmMinTitleVisiable
(
View
.
GONE
)
}
else
{
//对方是用户,自己是助理
if
(
actionHandler
.
userType
==
USER_TYPE_USER
&&
ModularServiceManager
.
provide
(
IUserService
::
class
.
java
)
if
(
actionHandler
.
userType
==
USER_TYPE_USER
&&
ModularServiceManager
.
provide
(
IUserService
::
class
.
java
)
.
getUserInfo
()
?.
user_type
==
USER_TYPE_ASSISTANT
)
{
tb
.
setTitleTextRightIcon
(
R
.
drawable
.
user_info_icon
)
{
...
...
m-im/src/main/java/com/yidianling/uikit/api/NimUIKit.java
View file @
68c46651
...
...
@@ -5,6 +5,8 @@ import android.content.Context;
import
com.netease.nimlib.sdk.msg.attachment.MsgAttachment
;
import
com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
;
import
com.netease.nimlib.sdk.msg.model.IMMessage
;
import
com.ydl.ydlnet.utils.log.AliYunLogConfig
;
import
com.ydl.ydlnet.utils.log.AliYunLogHelper
;
import
com.yidianling.nimbase.api.BaseNimUIKit
;
import
com.yidianling.nimbase.api.model.session.SessionCustomization
;
import
com.yidianling.uikit.business.contact.selector.activity.ContactSelectActivity
;
...
...
@@ -30,6 +32,7 @@ public class NimUIKit extends BaseNimUIKit {
*/
public
static
void
startYDLChatting
(
Context
context
,
String
id
,
SessionTypeEnum
sessionType
,
SessionCustomization
customization
,
IMMessage
anchor
,
IP2PCustomActionHandler
handler
)
{
AliYunLogHelper
.
Companion
.
getInstance
().
sendLog
(
AliYunLogConfig
.
YUNXIN
,
"startYDLChatting 打开壹点灵定制聊天窗口,开始聊天"
);
NimUIKitImpl
.
startChatting
(
context
,
id
,
sessionType
,
customization
,
anchor
,
handler
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment