修复多人PK接收方次数用完依旧会加入的问题
This commit is contained in:
parent
fe124dad0c
commit
0b041bad7b
@ -26,6 +26,7 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
@ -36,6 +37,7 @@ import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.custom.ProgressTextView;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.socket.SocketRyLinkMicPkUtil;
|
||||
@ -44,6 +46,7 @@ import com.yunbao.live.views.LiveLinkMicPkViewHolder;
|
||||
import com.yunbao.live.views.LivePushRyViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
@ -71,6 +74,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.LiveRyAnchorActivity.isDRPK;
|
||||
import static com.yunbao.live.views.AbsRyLivePushViewHolder.leave;
|
||||
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
|
||||
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView1;
|
||||
import static com.yunbao.live.views.LivePushRyViewHolder.contexts;
|
||||
@ -643,6 +647,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
//1. 设置自适应合流布局模式
|
||||
config.setLayoutMode(RCRTCMixConfig.MixLayoutMode.ADAPTIVE);
|
||||
//2. 合流画布设置
|
||||
if (rcrtcLiveInfo == null) {
|
||||
Log.w("PkDebug", "PK合流失败,rcrtcLiveInfo为空");
|
||||
}
|
||||
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
@ -834,6 +841,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.UN_LEAVELIVE));
|
||||
LiveRyAnchorActivity.isDRPK = 1;
|
||||
LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE);
|
||||
SocketRyLinkMicPkUtil.linkMicPkAccept(mSocketRyClient, mApplyUid, mApplyUrl, mApplyNmae);
|
||||
@ -1053,7 +1062,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
private String TAG="多人PK";
|
||||
/**
|
||||
* 退出多人PK
|
||||
*/
|
||||
@ -1111,6 +1120,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
videoLayout1.setWidth(720); // 视频窗口的宽
|
||||
videoLayout1.setHeight(1280); // 视频窗口的高
|
||||
//2. 合流画布设置
|
||||
if (rcrtcLiveInfo != null) {
|
||||
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
@ -1124,6 +1134,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
//恢复全屏画面
|
||||
@ -1175,6 +1186,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
@Override
|
||||
public void onSuccess(int code, String msgs, String[] info) {
|
||||
if (code == 0) {
|
||||
Log.i("多人PK","1code = " + code + ", msgs = " + msgs + ", info = " + Arrays.deepToString(info)+" mApplyUid = "+mApplyUid);
|
||||
if (info.length == 0) {
|
||||
ToastUtil.show("多人PK次数已用完");
|
||||
return;
|
||||
}
|
||||
rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, true, true, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
@ -1185,6 +1201,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i("多人PK","code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LIVE_DRPK)
|
||||
.param("action", 10)
|
||||
@ -1214,10 +1232,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
Log.e("ry", "发送失敗");
|
||||
}
|
||||
});
|
||||
if(info.length==0){
|
||||
ToastUtil.show(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
JSONArray users = obj.getJSONArray("userlist");
|
||||
|
||||
@ -1874,6 +1889,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
* 主播与主播PK 断开连麦PK的回调
|
||||
*/
|
||||
public void onLinkMicPkClose(int i) {
|
||||
|
||||
// //恢复播放画面
|
||||
if (i == 1) {
|
||||
if (rtcRoom != null) {
|
||||
@ -1902,6 +1918,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
//1. 设置自适应合流布局模式
|
||||
config.setLayoutMode(RCRTCMixConfig.MixLayoutMode.ADAPTIVE);
|
||||
//2. 合流画布设置
|
||||
if (rcrtcLiveInfo != null) {
|
||||
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
@ -1915,6 +1932,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
// try {
|
||||
|
Loading…
Reference in New Issue
Block a user