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
353d4088
Commit
353d4088
authored
Aug 31, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/qj/netease5' into 'd/4.4.10'
网易呼叫组件2.0升级sdk适配 See merge request app_android_lib/YDL-Component!348
parents
c2689a91
9729ce70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
build.gradle
m-im/build.gradle
+1
-1
NimUICallInit.java
m-im/src/main/java/com/yidianling/im/helper/NimUICallInit.java
+21
-9
No files found.
m-im/build.gradle
View file @
353d4088
...
...
@@ -60,7 +60,7 @@ dependencies {
api
rootProject
.
ext
.
dependencies
[
"ydl-user-router"
]
implementation
rootProject
.
ext
.
dependencies
[
"BaseRecyclerViewAdapterHelper"
]
implementation
(
'com.netease.yunxin.kit:call-ui:1.
5.9-SNAPSHOT
'
)
{
implementation
(
'com.netease.yunxin.kit:call-ui:1.
6.3
'
)
{
exclude
group:
"com.netease.nimlib"
,
module:
"avsignalling"
exclude
group:
"com.netease.nimlib"
,
module:
"basesdk"
}
...
...
m-im/src/main/java/com/yidianling/im/helper/NimUICallInit.java
View file @
353d4088
...
...
@@ -2,18 +2,20 @@ package com.yidianling.im.helper;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.os.Looper
;
import
android.text.TextUtils
;
import
com.netease.lava.nertc.sdk.NERtcConstants
;
import
com.netease.lava.nertc.sdk.NERtcEx
;
import
com.netease.lava.nertc.sdk.NERtcOption
;
import
com.netease.lava.nertc.sdk.video.NERtcEncodeConfig
;
import
com.netease.lava.nertc.sdk.video.NERtcVideoConfig
;
import
com.netease.nimlib.sdk.RequestCallback
;
import
com.netease.yunxin.nertc.nertcvideocall.bean.InvitedInfo
;
import
com.netease.yunxin.nertc.nertcvideocall.model.NERtcCallExtension
;
import
com.netease.yunxin.nertc.ui.CallKitNotificationConfig
;
import
com.netease.yunxin.nertc.ui.CallKitUI
;
import
com.netease.yunxin.nertc.ui.CallKitUIOptions
;
import
com.netease.yunxin.nertc.ui.extension.SelfConfigExtension
;
import
com.netease.yunxin.nertc.ui.service.DefaultIncomingCallEx
;
import
com.ydl.ydlcommon.modular.ModularServiceManagerKt
;
import
com.ydl.ydlcommon.utils.log.XLog
;
...
...
@@ -42,7 +44,9 @@ public class NimUICallInit {
UserResponseBean
.
UserInfo
userInfo
=
ModularServiceManagerKt
.
findRouteService
(
IUserService
.
class
).
getUserInfo
();
if
(
userInfo
==
null
)
return
;
String
userId
=
userInfo
.
getUid
();
android
.
util
.
Log
.
e
(
"qwert"
,
userId
);
//防止网络波动的情况下多次触发LOGINED状态,导致呼叫组件重新初始化
if
(
TextUtils
.
equals
(
userId
,
CallKitUI
.
INSTANCE
.
getCurrentUserAccId
()))
return
;
android
.
util
.
Log
.
e
(
"qwert"
,
userId
+
(
Looper
.
myLooper
()
==
Looper
.
getMainLooper
()));
String
appKey
=
NimApplication
.
getInstance
().
getAppKey
();
CallKitUIOptions
options
=
new
CallKitUIOptions
.
Builder
()
// 必要:音视频通话 sdk appKey,用于通话中使用
...
...
@@ -53,15 +57,20 @@ public class NimUICallInit {
.
currentUserRtcUId
(
Long
.
parseLong
(
userId
))
// 通话接听成功的超时时间单位 毫秒,默认30s
.
timeOutMillisecond
(
30
*
1000L
)
.
rtcCallExtension
(
new
SelfConfig
Extension
(){
.
rtcCallExtension
(
new
NERtcCall
Extension
(){
@Override
p
ublic
void
configVideoConfig
(
)
{
p
rotected
int
joinChannel
(
String
token
,
String
channelName
,
long
rtcUid
)
{
NERtcVideoConfig
videoConfig
=
new
NERtcVideoConfig
();
videoConfig
.
frameRate
=
NERtcEncodeConfig
.
NERtcVideoFrameRate
.
FRAME_RATE_FPS_15
;
videoConfig
.
bitrate
=
600
;
videoConfig
.
width
=
640
;
videoConfig
.
height
=
480
;
videoConfig
.
degradationPrefer
=
NERtcVideoConfig
.
NERtcDegradationPreference
.
DEGRADATION_MAINTAIN_FRAMERATE
;
NERtcEx
.
getInstance
().
setLocalVideoConfig
(
videoConfig
);
// 音频设置 standard + speech
NERtcEx
.
getInstance
().
setAudioProfile
(
NERtcConstants
.
AudioProfile
.
STANDARD
,
NERtcConstants
.
AudioScenario
.
SPEECH
);
// 设置 channel profile
NERtcEx
.
getInstance
().
setChannelProfile
(
NERtcConstants
.
RTCChannelProfile
.
COMMUNICATION
);
return
NERtcEx
.
getInstance
().
joinChannel
(
token
,
channelName
,
rtcUid
);
}
})
// 此处为 收到来电时展示的 notification 相关配置,如图标,提示语等。
...
...
@@ -80,9 +89,12 @@ public class NimUICallInit {
// .p2pAudioActivity(TestActivity.class)
// .p2pVideoActivity(TestActivity.class)
// 请求 rtc token 服务,若非安全模式则不需设置
.
rtcTokenService
((
uid
,
c
allback
)
->
requestRtcToken
(
uid
,
callback
))
// 自己实现的 token 请求方法
.
rtcTokenService
((
uid
,
c
hannel
,
callback
)
->
requestRtcToken
(
uid
,
channel
,
callback
))
// 自己实现的 token 请求方法
// 设置初始化 rtc sdk 相关配置,按照所需进行配置
.
rtcSdkOption
(
new
NERtcOption
())
.
enableMsgFilter
(
false
)
.
enableCustomParser
(
false
)
.
audio2VideoConfirm
(
true
)
// 呼叫组件初始化 rtc 范围,true-全局初始化,false-每次通话进行初始化以及销毁
// 全局初始化有助于更快进入首帧页面,当结合其他组件使用时存在rtc初始化冲突可设置false
.
rtcInitScope
(
true
)
...
...
@@ -92,10 +104,10 @@ public class NimUICallInit {
}
@SuppressLint
(
"CheckResult"
)
private
static
void
requestRtcToken
(
long
uid
,
RequestCallback
<
String
>
callback
)
{
private
static
void
requestRtcToken
(
long
uid
,
String
channel
,
RequestCallback
<
String
>
callback
)
{
Map
<
String
,
String
>
body
=
new
HashMap
<>();
if
(
c
urChannelName
!=
null
)
{
body
.
put
(
"channelName"
,
c
urChannelName
);
if
(
c
hannel
!=
null
)
{
body
.
put
(
"channelName"
,
c
hannel
);
}
body
.
put
(
"uid"
,
String
.
valueOf
(
uid
));
ImHttpImpl
.
Companion
.
getInstance
().
getImApi
().
nim2Token
(
body
)
...
...
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