Commit 41bc719d by 万齐军

yx2.0

parent c8869ad9
......@@ -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 SelfConfigExtension(){
.rtcCallExtension(new NERtcCallExtension(){
@Override
public void configVideoConfig() {
protected 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 相关配置,如图标,提示语等。
......
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