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