修复:人Pk状态展示不正常
This commit is contained in:
parent
49167f332d
commit
f024283e80
@ -1,7 +1,5 @@
|
|||||||
package com.yunbao.live.presenter;
|
package com.yunbao.live.presenter;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
|
|
||||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
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;
|
||||||
@ -13,6 +11,7 @@ import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo;
|
|||||||
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
|
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
|
||||||
import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
|
import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@ -30,26 +29,20 @@ import android.view.Gravity;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.tencent.trtc.TRTCCloud;
|
import com.tencent.trtc.TRTCCloud;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.bean.LiveInfoModel;
|
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
|
||||||
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.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMRTCManager;
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
import com.yunbao.common.manager.RandomPkManager;
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
@ -69,8 +62,6 @@ import com.yunbao.live.socket.SocketRyLinkMicPkUtil;
|
|||||||
import com.yunbao.live.socket.SocketSendBean;
|
import com.yunbao.live.socket.SocketSendBean;
|
||||||
import com.yunbao.live.views.LiveLinkMicPkViewHolder;
|
import com.yunbao.live.views.LiveLinkMicPkViewHolder;
|
||||||
import com.yunbao.live.views.LivePushRyViewHolder;
|
import com.yunbao.live.views.LivePushRyViewHolder;
|
||||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
|
||||||
import com.yunbao.live.views.PortraitLiveManager;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
@ -1313,107 +1304,113 @@ 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(TAG, "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
Log.i(TAG, "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||||
JSONObject datas = JSONObject.parseObject(info[0]);
|
if (info.length > 0) {
|
||||||
boolean agree = true;
|
|
||||||
if (datas.getIntValue("pk_num_day") <= 0) {
|
|
||||||
ToastUtil.show("多人PK次数已用完");
|
|
||||||
agree = false;
|
|
||||||
}
|
|
||||||
boolean finalAgree = agree;
|
|
||||||
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, agree, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
if (finalAgree == true) {
|
|
||||||
HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom")
|
|
||||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
|
||||||
.params("roomid", u.getId())
|
|
||||||
.execute(new HttpCallback() {
|
|
||||||
|
|
||||||
@Override
|
JSONObject datas = JSONObject.parseObject(info[0]);
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
boolean agree = true;
|
||||||
Log.i("多人PK", "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
if (datas.getIntValue("pk_num_day") <= 0) {
|
||||||
|
ToastUtil.show("多人PK次数已用完");
|
||||||
|
agree = false;
|
||||||
|
}
|
||||||
|
boolean finalAgree = agree;
|
||||||
|
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, agree, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
if (finalAgree == true) {
|
||||||
|
HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom")
|
||||||
|
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||||
|
.params("roomid", u.getId())
|
||||||
|
.execute(new HttpCallback() {
|
||||||
|
|
||||||
final SocketSendBean msg1 = new SocketSendBean()
|
@Override
|
||||||
.param("_method_", SOCKET_LIVE_DRPK)
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
.param("action", 10)
|
Log.i("多人PK", "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
|
||||||
msg1.create();
|
|
||||||
String targetId = "g" + CommonAppConfig.getInstance().getUid();
|
|
||||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
|
|
||||||
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() {
|
final SocketSendBean msg1 = new SocketSendBean()
|
||||||
@Override
|
.param("_method_", SOCKET_LIVE_DRPK)
|
||||||
public void onAttached(io.rong.imlib.model.Message message) {
|
.param("action", 10)
|
||||||
|
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||||
|
msg1.create();
|
||||||
|
String targetId = "g" + CommonAppConfig.getInstance().getUid();
|
||||||
|
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
|
||||||
|
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
|
@Override
|
||||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||||
Log.e("ry", "发送失敗");
|
Log.e("ry", "发送成功");
|
||||||
}
|
if (SocketRyClient.mSocketHandler != null) {
|
||||||
});
|
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||||
if (info.length == 0) {
|
}
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
|
||||||
JSONArray users = obj.getJSONArray("userlist");
|
|
||||||
|
|
||||||
//添加水印
|
@Override
|
||||||
|
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||||
|
Log.e("ry", "发送失敗");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (info.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||||
|
JSONArray users = obj.getJSONArray("userlist");
|
||||||
|
|
||||||
|
//添加水印
|
||||||
// RCRTCRect rect = new RCRTCRect(0.5f, 0.5f, 0.2f);
|
// RCRTCRect rect = new RCRTCRect(0.5f, 0.5f, 0.2f);
|
||||||
// RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(fromText(50, mNameText), rect);
|
// RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(fromText(50, mNameText), rect);
|
||||||
dRjoinOtherRoom(u.getId(), 1);
|
dRjoinOtherRoom(u.getId(), 1);
|
||||||
|
|
||||||
for (int i = 0; i < users.size(); i++) {
|
for (int i = 0; i < users.size(); i++) {
|
||||||
JSONObject user = users.getJSONObject(i);
|
JSONObject user = users.getJSONObject(i);
|
||||||
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
|
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
|
||||||
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) {
|
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) {
|
||||||
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) {
|
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) {
|
||||||
/**
|
/**
|
||||||
* 向指定用户发送跨房间连麦请求
|
* 向指定用户发送跨房间连麦请求
|
||||||
* <P>
|
* <P>
|
||||||
* 1: inviterAutoMix为true时:
|
* 1: inviterAutoMix为true时:
|
||||||
*
|
*
|
||||||
* 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。
|
* 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。
|
||||||
*
|
*
|
||||||
* 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。
|
* 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。
|
||||||
*
|
*
|
||||||
* 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
* 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||||
* <P/>
|
* <P/>
|
||||||
*/
|
*/
|
||||||
IMRTCManager.getInstance().requestJoinOtherRoom(user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().requestJoinOtherRoom(user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(RTCErrorCode errorCode) {
|
public void onFailed(RTCErrorCode errorCode) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(RTCErrorCode errorCode) {
|
public void onFailed(RTCErrorCode errorCode) {
|
||||||
ToastUtil.show("接受失败");
|
ToastUtil.show("接受失败");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}else {
|
||||||
|
ToastUtil.show(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -644,6 +644,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
img.setImageResource(R.mipmap.icon_no4);
|
img.setImageResource(R.mipmap.icon_no4);
|
||||||
} else if (j == 5) {
|
} else if (j == 5) {
|
||||||
img.setImageResource(R.mipmap.icon_no5);
|
img.setImageResource(R.mipmap.icon_no5);
|
||||||
|
}else {
|
||||||
|
img.setImageResource(R.mipmap.icon_no1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user