diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index da661857c..f35fbe826 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -228,7 +228,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl long lossRate = statusBean.packetLostRate; //带宽 String googAvailableSendBandwidth = statusReport.googAvailableSendBandwidth; - Log.e("网速和内存", "获取视频:" + resolution + " 丢包率:" + lossRate + " 带宽:" + googAvailableSendBandwidth); +// Log.e("网速和内存", "获取视频:" + resolution + " 丢包率:" + lossRate + " 带宽:" + googAvailableSendBandwidth); } } }); @@ -1632,6 +1632,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl case DISCONNEXT_PK_TIME: if (mLivePushViewHolder != null) { mLivePushViewHolder.changeToBig(); + mLiveRyLinkMicPkPresenter.leaveDRRoom(); } break; case AI_AUTOMATIC_SPEECH: diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index e5f9130c8..8fa494aef 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -4,6 +4,7 @@ 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; +import static com.yunbao.live.activity.LiveRyAnchorActivity.PKing; import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK; import static com.yunbao.live.views.LivePushRyViewHolder.btn_close; import static com.yunbao.live.views.LivePushRyViewHolder.contexts; @@ -2324,12 +2325,21 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { * 主播与主播PK 断开连麦PK的回调 */ public void onLinkMicPkClose(int i) { + Log.e("ry",mPkUid+"aaaaqwqw"+i); + + PKing = false; + LiveRyAnchorActivity.isDRPK = 0; // //恢复播放画面 if (i == 1) { - if (btn_close != null) { - btn_close.setVisibility(View.GONE); - } + runOnUiThread(new Runnable() { + @Override + public void run() { + if (btn_close != null) { + btn_close.setVisibility(View.GONE); + } + } + }); // inputStreamList.clear(); RCRTCMixConfig config = new RCRTCMixConfig(); RCRTCMixConfig.MediaConfig mediaConfig = new RCRTCMixConfig.MediaConfig(); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index af15fe290..62f248e24 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -70,6 +70,7 @@ import org.greenrobot.eventbus.EventBus; import java.lang.ref.WeakReference; import java.util.List; +import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; import cn.rongcloud.rtc.base.RTCErrorCode; import io.rong.imlib.IRongCoreCallback; @@ -1262,9 +1263,22 @@ public class SocketRyClient { mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders")); break; case 5://PK时候断开连麦的回调 - if (rtcRoom != null) { +// if (rtcRoom != null) { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.DISCONNEXT_PK_TIME)); + RCRTCEngine.getInstance().leaveOtherRoom(map.getString("pkuid"), true, new IRCRTCResultCallback() { + @Override + public void onSuccess() { + Log.e("ry", map.getString("pkuid")+"退出多人成功a as"); + + } + + @Override + public void onFailed(RTCErrorCode rtcErrorCode) { + Log.e("ry", map.getString("pkuid")+"退asa出多人失败" + rtcErrorCode); + + } + }); //断开连麦 HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout") .execute(new HttpCallback() { @@ -1273,7 +1287,7 @@ public class SocketRyClient { } }); - } +// } mListener.onLinkMicPkClose(1); if (RandomPkManager.getInstance().isRandomModel()) { RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_DEFAULT); diff --git a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java index 6554c3684..b45d78e5e 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -4,6 +4,7 @@ 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.activity.LiveRyAnchorActivity.PKing; import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList; import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList1; import static cn.rongcloud.rtc.base.RCRTCLiveRole.BROADCASTER; @@ -436,7 +437,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX @Override public void onSuccess() { Log.e("ry",roomId+"退出啊房间成功"+userId); - } @Override