修改融云合流不成功的问题,退出画面有问题
This commit is contained in:
parent
d899975495
commit
7a26e81f67
@ -1,5 +1,6 @@
|
||||
package com.yunbao.live.presenter;
|
||||
|
||||
import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
|
||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||
@ -36,6 +37,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.ViewUtils;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
@ -714,7 +716,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
inputStreamList.add(stream);
|
||||
|
||||
|
||||
|
||||
RCRTCMixConfig config = new RCRTCMixConfig();
|
||||
RCRTCMixConfig.MediaConfig mediaConfig = new RCRTCMixConfig.MediaConfig();
|
||||
config.setMediaConfig(mediaConfig);
|
||||
@ -1128,22 +1129,30 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
public void leaveDRRoom() {
|
||||
//清理PK上面对方的头像
|
||||
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
|
||||
|
||||
Log.e("ry", "退出多人OKKK" + inputStreamList.size());
|
||||
isDRPK = 0;
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (btn_close != null) {
|
||||
btn_close.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < inputStreamList.size(); i++) {
|
||||
Log.e("ry", "退出多人ID" + inputStreamList.get(i).getUserId());
|
||||
//退出副房间
|
||||
RCRTCEngine.getInstance().leaveOtherRoom(inputStreamList.get(i).getUserId(), true, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry", "退出多人成功");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode rtcErrorCode) {
|
||||
Log.e("ry", "退出多人失败" + rtcErrorCode);
|
||||
|
||||
}
|
||||
});
|
||||
@ -2179,6 +2188,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
/**
|
||||
* 修改最终PK数据
|
||||
*
|
||||
* @param leftGift 左边数据
|
||||
* @param rightGift 右边数据
|
||||
* @param bean 排位数据
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
|
||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||
import static com.yunbao.live.activity.LiveActivity.mLiveRyLinkMicPkPresenter;
|
||||
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList;
|
||||
@ -55,6 +56,7 @@ import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.momo.TencentTRTCBeautyManager;
|
||||
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -82,6 +84,10 @@ import cn.rongcloud.rtc.base.RCRTCRoomType;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import cn.rongcloud.rtc.core.CameraVideoCapturer;
|
||||
import cn.rongcloud.rtc.core.RendererCommon;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
@ -218,10 +224,54 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
@Override
|
||||
public void run() {
|
||||
Log.e("ry", inviterRoomId + extra + "Request");
|
||||
|
||||
UserBean userBean = new UserBean();
|
||||
userBean.setId(inviterRoomId);
|
||||
if (extra.equals(SOCKET_LIVE_DRPK)) {
|
||||
//收到邀请这个时候正在PK或连麦中 自动拒绝对方
|
||||
if (isPking() == true) {
|
||||
|
||||
rtcRoom.getLocalUser().responseJoinOtherRoom(userBean.getId(), userBean.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||
.param("action", 8);
|
||||
msg1.create();
|
||||
|
||||
String targetId = userBean.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + userBean.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}else if (extra.equals(SOCKET_LIVE_DRPK)) {
|
||||
//收到多人PK申请
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean);
|
||||
@ -381,6 +431,22 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
@Override
|
||||
public void onFinishOtherRoom(String roomId, String userId) {
|
||||
super.onFinishOtherRoom(roomId, userId);
|
||||
Log.e("ry",roomId+"房间是"+userId);
|
||||
RCRTCEngine.getInstance().leaveOtherRoom(roomId, true, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry",roomId+"退出啊房间成功"+userId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry",roomId+"退出啊房间失败"+userId);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.leaveDRRoom();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user