zb端多人Pk合流完成,Pk结束完成
This commit is contained in:
parent
7ebd935eba
commit
4cd4939c58
@ -10,9 +10,9 @@ ext {
|
|||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式
|
//正式
|
||||||
|
|
||||||
// serverHost : "https://napi.yaoulive.com",
|
serverHost : "https://napi.yaoulive.com",
|
||||||
//測試
|
//測試
|
||||||
serverHost : "https://ceshi.yaoulive.com",
|
// serverHost : "https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||||
|
@ -1359,6 +1359,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
mLiveRyLinkMicPkPresenter.upDataPkScore(event.getPkScores(), event.getUid(), event.getTime());
|
mLiveRyLinkMicPkPresenter.upDataPkScore(event.getPkScores(), event.getUid(), event.getTime());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PK_TIME_COUNT:
|
||||||
|
if (mLiveRoomViewHolder != null) {
|
||||||
|
mLiveRoomViewHolder.endDRGif();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,8 +227,9 @@ public class LiveAudienceEvent extends BaseModel {
|
|||||||
LINK_MIC_CLOSE(43, "主播关闭连麦房"),
|
LINK_MIC_CLOSE(43, "主播关闭连麦房"),
|
||||||
SOCKET_LIVE_DRPK_SET_PK_VIEW(44, "setPkview"),
|
SOCKET_LIVE_DRPK_SET_PK_VIEW(44, "setPkview"),
|
||||||
SOCKET_LIVE_DRPK_SET_PK_END_VIEW(45, "setPkEndview"),
|
SOCKET_LIVE_DRPK_SET_PK_END_VIEW(45, "setPkEndview"),
|
||||||
LEAVE_DR_ROOM(44, "结束多人PK"),
|
LEAVE_DR_ROOM(46, "结束多人PK"),
|
||||||
LEAVE_PK_SCORE(45, "PK排名");
|
LEAVE_PK_SCORE(47, "PK排名"),
|
||||||
|
PK_TIME_COUNT(48, "多人PK结束");
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -99,6 +99,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
private static final int WHAT_PK_WAIT_RECEIVE = 0;//收到pk申请等待 what
|
private static final int WHAT_PK_WAIT_RECEIVE = 0;//收到pk申请等待 what
|
||||||
private static final int WHAT_PK_WAIT_SEND = 1;//发送pk申请等待 what
|
private static final int WHAT_PK_WAIT_SEND = 1;//发送pk申请等待 what
|
||||||
private static final int WHAT_PK_TIME = 2;//pk时间变化 what
|
private static final int WHAT_PK_TIME = 2;//pk时间变化 what
|
||||||
|
private static final int WHAT_PK_TIME2 = 22;//pk时间变化 what
|
||||||
private static final int LINK_MIC_COUNT_MAX = 10;
|
private static final int LINK_MIC_COUNT_MAX = 10;
|
||||||
private static int PK_TIME_MAX = 60 * 15;//pk时间 15分钟
|
private static int PK_TIME_MAX = 60 * 15;//pk时间 15分钟
|
||||||
private static final int PK_TIME_MAX_2 = 60;//惩罚时间 1分钟
|
private static final int PK_TIME_MAX_2 = 60;//惩罚时间 1分钟
|
||||||
@ -222,6 +223,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
case WHAT_PK_TIME:
|
case WHAT_PK_TIME:
|
||||||
changePkTime();
|
changePkTime();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -259,8 +261,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
case WHAT_PK_WAIT_SEND:
|
case WHAT_PK_WAIT_SEND:
|
||||||
onSendPkWait();
|
onSendPkWait();
|
||||||
break;
|
break;
|
||||||
case WHAT_PK_TIME:
|
case WHAT_PK_TIME2:
|
||||||
changePkTime();
|
pkCountdownTimer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1211,7 +1213,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
livePushRyViewHolder.dr3_preview.removeAllViews();
|
livePushRyViewHolder.dr3_preview.removeAllViews();
|
||||||
livePushRyViewHolder.cameraPreview3.removeAllViews();
|
livePushRyViewHolder.cameraPreview3.removeAllViews();
|
||||||
leaveHandler.removeCallbacks(leaveRunnable);
|
leaveHandler.removeCallbacks(leaveRunnable);
|
||||||
|
livePushRyViewHolder.timeTitle.setVisibility(View.GONE);
|
||||||
|
livePushRyViewHolder.mPreView.removeView(detailsView1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1255,92 +1258,92 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
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]);
|
JSONObject datas = JSONObject.parseObject(info[0]);
|
||||||
boolean agree=true;
|
boolean agree = true;
|
||||||
if (datas.getIntValue("pk_num_day") <= 0) {
|
if (datas.getIntValue("pk_num_day") <= 0) {
|
||||||
ToastUtil.show("多人PK次数已用完");
|
ToastUtil.show("多人PK次数已用完");
|
||||||
agree=false;
|
agree = false;
|
||||||
}
|
}
|
||||||
boolean finalAgree = agree;
|
boolean finalAgree = agree;
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, agree, true, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, agree, true, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
if(finalAgree == true){
|
if (finalAgree == true) {
|
||||||
HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom")
|
HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom")
|
||||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||||
.params("roomid", u.getId())
|
.params("roomid", u.getId())
|
||||||
.execute(new HttpCallback() {
|
.execute(new HttpCallback() {
|
||||||
|
|
||||||
@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));
|
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)
|
||||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||||
msg1.create();
|
msg1.create();
|
||||||
String targetId = "g" + CommonAppConfig.getInstance().getUid();
|
String targetId = "g" + CommonAppConfig.getInstance().getUid();
|
||||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
|
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
|
||||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||||
|
|
||||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onAttached(io.rong.imlib.model.Message message) {
|
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 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", "发送失敗");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (info.length == 0) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||||
|
JSONArray users = obj.getJSONArray("userlist");
|
||||||
|
dRjoinOtherRoom(u.getId(), 1);
|
||||||
|
for (int i = 0; i < users.size(); i++) {
|
||||||
|
JSONObject user = users.getJSONObject(i);
|
||||||
|
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
|
||||||
|
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) {
|
||||||
|
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) {
|
||||||
|
/**
|
||||||
|
* 向指定用户发送跨房间连麦请求
|
||||||
|
* <P>
|
||||||
|
* 1: inviterAutoMix为true时:
|
||||||
|
*
|
||||||
|
* 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。
|
||||||
|
*
|
||||||
|
* 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。
|
||||||
|
*
|
||||||
|
* 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||||
|
* <P/>
|
||||||
|
*/
|
||||||
|
rtcRoom.getLocalUser().requestJoinOtherRoom(user.getString("id"), user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
public void onFailed(RTCErrorCode errorCode) {
|
||||||
Log.e("ry", "发送失敗");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (info.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
|
||||||
JSONArray users = obj.getJSONArray("userlist");
|
|
||||||
dRjoinOtherRoom(u.getId(), 1);
|
|
||||||
for (int i = 0; i < users.size(); i++) {
|
|
||||||
JSONObject user = users.getJSONObject(i);
|
|
||||||
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
|
|
||||||
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) {
|
|
||||||
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) {
|
|
||||||
/**
|
|
||||||
* 向指定用户发送跨房间连麦请求
|
|
||||||
* <P>
|
|
||||||
* 1: inviterAutoMix为true时:
|
|
||||||
*
|
|
||||||
* 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。
|
|
||||||
*
|
|
||||||
* 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。
|
|
||||||
*
|
|
||||||
* 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
|
||||||
* <P/>
|
|
||||||
*/
|
|
||||||
rtcRoom.getLocalUser().requestJoinOtherRoom(user.getString("id"), user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void onFailed(RTCErrorCode errorCode) {
|
});
|
||||||
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1842,7 +1845,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
* @param streams 必须为视频流列表
|
* @param streams 必须为视频流列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static RCRTCMixConfig create_Custom_MixConfig(boolean isCrop, List<RCRTCInputStream> streams) {
|
private RCRTCMixConfig create_Custom_MixConfig(boolean isCrop, List<RCRTCInputStream> streams) {
|
||||||
|
Log.e("视频合流", streams.toString());
|
||||||
|
Log.e("视频合流", "视频长度:" + streams.size());
|
||||||
RCRTCMixConfig config = new RCRTCMixConfig();
|
RCRTCMixConfig config = new RCRTCMixConfig();
|
||||||
//1. 设置自定义合流布局模式
|
//1. 设置自定义合流布局模式
|
||||||
config.setLayoutMode(RCRTCMixConfig.MixLayoutMode.CUSTOM);
|
config.setLayoutMode(RCRTCMixConfig.MixLayoutMode.CUSTOM);
|
||||||
@ -1870,62 +1875,92 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
//(请参照画布和声音配置示例代码)
|
//(请参照画布和声音配置示例代码)
|
||||||
//3. 假设以画布设置的宽高为 300 * 300为例(应以真实设置的宽高为准),设置每个视频流小窗口的坐标及宽高
|
//3. 假设以画布设置的宽高为 300 * 300为例(应以真实设置的宽高为准),设置每个视频流小窗口的坐标及宽高
|
||||||
ArrayList<RCRTCMixConfig.CustomLayoutList.CustomLayout> list = new ArrayList<>();
|
ArrayList<RCRTCMixConfig.CustomLayoutList.CustomLayout> list = new ArrayList<>();
|
||||||
config.setCustomLayouts(list);
|
|
||||||
//user1的视频流
|
|
||||||
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout1 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
|
||||||
list.add(videoLayout1);
|
|
||||||
videoLayout1.setVideoStream(RCRTCEngine.getInstance().getDefaultVideoStream()); // RCRTCStream#MediaType 必须是Video
|
|
||||||
videoLayout1.setX(0); //X 坐标
|
|
||||||
videoLayout1.setY(0); //Y 坐标
|
|
||||||
videoLayout1.setWidth(480); // 视频窗口的宽
|
|
||||||
videoLayout1.setHeight(720); // 视频窗口的高
|
|
||||||
|
|
||||||
for (int i = 0; i < streams.size(); i++) {
|
if (streams.size() == 1) {
|
||||||
Log.e("tttts,", "a" + i + "cccc" + streams.size());
|
//user1的视频流
|
||||||
Log.e("tttts", streams.get(i).getUserId() + "");
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout1 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
if (i == 0) {
|
videoLayout1.setVideoStream(RCRTCEngine.getInstance().getDefaultVideoStream()); // RCRTCStream#MediaType 必须是Video
|
||||||
//user2的视频流
|
videoLayout1.setX(0); //X 坐标
|
||||||
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout2 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
videoLayout1.setY(0); //Y 坐标
|
||||||
list.add(videoLayout2);
|
videoLayout1.setWidth(480); // 视频窗口的宽
|
||||||
videoLayout2.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video
|
videoLayout1.setHeight(720); // 视频窗口的高
|
||||||
videoLayout2.setX(480); //X 坐标
|
list.add(videoLayout1);
|
||||||
videoLayout2.setY(0); //Y 坐标
|
|
||||||
videoLayout2.setWidth(480); // 视频窗口的宽
|
|
||||||
videoLayout2.setHeight(720); // 视频窗口的高
|
|
||||||
Log.e("ttt1112", "0" + "VS" + streams.get(i).getUserId());
|
|
||||||
} else if (i == 1) {
|
|
||||||
//user3的视频流
|
|
||||||
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout3 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
|
||||||
list.add(videoLayout3);
|
|
||||||
videoLayout3.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video
|
|
||||||
videoLayout3.setX(720); //X 坐标
|
|
||||||
videoLayout3.setY(0); //Y 坐标
|
|
||||||
videoLayout3.setWidth(240); // 视频窗口的宽
|
|
||||||
videoLayout3.setHeight(360); // 视频窗口的高
|
|
||||||
Log.e("ttt1112", "1" + "VS" + streams.get(i).getUserId());
|
|
||||||
|
|
||||||
} else if (i == 2) {
|
//user2的视频流
|
||||||
//user3的视频流
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout2 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout4 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
videoLayout2.setVideoStream(streams.get(0)); // RCRTCStream#MediaType 必须是Video
|
||||||
list.add(videoLayout4);
|
videoLayout2.setX(480); //X 坐标
|
||||||
videoLayout4.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video
|
videoLayout2.setY(0); //Y 坐标
|
||||||
videoLayout4.setX(480); //X 坐标
|
videoLayout2.setWidth(480); // 视频窗口的宽
|
||||||
videoLayout4.setY(360); //Y 坐标
|
videoLayout2.setHeight(720); // 视频窗口的高
|
||||||
videoLayout4.setWidth(240); // 视频窗口的宽
|
list.add(videoLayout2);
|
||||||
videoLayout4.setHeight(360); // 视频窗口的高
|
|
||||||
Log.e("ttt1112", "2" + "VS" + streams.get(i).getUserId());
|
} else if (streams.size() == 2) {
|
||||||
} else if (i == 3) {
|
//user1的视频流
|
||||||
//user3的视频流
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout1 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout4 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
list.add(videoLayout1);
|
||||||
list.add(videoLayout4);
|
videoLayout1.setVideoStream(RCRTCEngine.getInstance().getDefaultVideoStream()); // RCRTCStream#MediaType 必须是Video
|
||||||
videoLayout4.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video
|
videoLayout1.setX(0); //X 坐标
|
||||||
videoLayout4.setX(720); //X 坐标
|
videoLayout1.setY(0); //Y 坐标
|
||||||
videoLayout4.setY(360); //Y 坐标
|
videoLayout1.setWidth(480); // 视频窗口的宽
|
||||||
videoLayout4.setWidth(240); // 视频窗口的宽
|
videoLayout1.setHeight(720); // 视频窗口的高
|
||||||
videoLayout4.setHeight(360); // 视频窗口的高
|
|
||||||
Log.e("ttt1112", "3" + "VS" + streams.get(i).getUserId());
|
//user2的视频流
|
||||||
}
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout2 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
|
videoLayout2.setVideoStream(streams.get(0)); // RCRTCStream#MediaType 必须是Video
|
||||||
|
videoLayout2.setX(480); //X 坐标
|
||||||
|
videoLayout2.setY(0); //Y 坐标
|
||||||
|
videoLayout2.setWidth(480); // 视频窗口的宽
|
||||||
|
videoLayout2.setHeight(360); // 视频窗口的高
|
||||||
|
list.add(videoLayout2);
|
||||||
|
|
||||||
|
//user3的视频流
|
||||||
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout3 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
|
videoLayout3.setVideoStream(streams.get(1)); // RCRTCStream#MediaType 必须是Video
|
||||||
|
videoLayout3.setX(480); //X 坐标
|
||||||
|
videoLayout3.setY(360); //Y 坐标
|
||||||
|
videoLayout3.setWidth(480); // 视频窗口的宽
|
||||||
|
videoLayout3.setHeight(360); // 视频窗口的高
|
||||||
|
list.add(videoLayout3);
|
||||||
|
|
||||||
|
} else if (streams.size() == 3) {
|
||||||
|
//user1的视频流
|
||||||
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout1 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
|
videoLayout1.setVideoStream(RCRTCEngine.getInstance().getDefaultVideoStream()); // RCRTCStream#MediaType 必须是Video
|
||||||
|
videoLayout1.setX(0); //X 坐标
|
||||||
|
videoLayout1.setY(0); //Y 坐标
|
||||||
|
videoLayout1.setWidth(480); // 视频窗口的宽
|
||||||
|
videoLayout1.setHeight(720); // 视频窗口的高
|
||||||
|
list.add(videoLayout1);
|
||||||
|
|
||||||
|
//user2的视频流
|
||||||
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout2 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
|
videoLayout2.setVideoStream(streams.get(0)); // RCRTCStream#MediaType 必须是Video
|
||||||
|
videoLayout2.setX(480); //X 坐标
|
||||||
|
videoLayout2.setY(0); //Y 坐标
|
||||||
|
videoLayout2.setWidth(480); // 视频窗口的宽
|
||||||
|
videoLayout2.setHeight(360); // 视频窗口的高
|
||||||
|
list.add(videoLayout2);
|
||||||
|
|
||||||
|
//user3的视频流
|
||||||
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout3 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
|
videoLayout3.setVideoStream(streams.get(1)); // RCRTCStream#MediaType 必须是Video
|
||||||
|
videoLayout3.setX(480); //X 坐标
|
||||||
|
videoLayout3.setY(360); //Y 坐标
|
||||||
|
videoLayout3.setWidth(480); // 视频窗口的宽
|
||||||
|
videoLayout3.setHeight(360); // 视频窗口的高
|
||||||
|
list.add(videoLayout3);
|
||||||
|
|
||||||
|
//user3的视频流
|
||||||
|
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout4 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
|
||||||
|
videoLayout4.setVideoStream(streams.get(2)); // RCRTCStream#MediaType 必须是Video
|
||||||
|
videoLayout4.setX(0); //X 坐标
|
||||||
|
videoLayout4.setY(360); //Y 坐标
|
||||||
|
videoLayout4.setWidth(480); // 视频窗口的宽
|
||||||
|
videoLayout4.setHeight(360); // 视频窗口的高
|
||||||
|
list.add(videoLayout4);
|
||||||
}
|
}
|
||||||
|
config.setCustomLayouts(list);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2285,6 +2320,10 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
layoutParams.topMargin = DpUtil.dp2px(123);
|
layoutParams.topMargin = DpUtil.dp2px(123);
|
||||||
livePushRyViewHolder.timeTitle.setLayoutParams(layoutParams);
|
livePushRyViewHolder.timeTitle.setLayoutParams(layoutParams);
|
||||||
livePushRyViewHolder.timeTitle.setVisibility(View.VISIBLE);
|
livePushRyViewHolder.timeTitle.setVisibility(View.VISIBLE);
|
||||||
|
String pkTime = StringUtil.getDurationText(time * 1000);
|
||||||
|
livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), pkTime));
|
||||||
|
mPkTimeCount = time;
|
||||||
|
pkCountdownTimer();
|
||||||
}
|
}
|
||||||
int pkScoreSize = pkScores.size();
|
int pkScoreSize = pkScores.size();
|
||||||
if (pkScoreSize == 3) {
|
if (pkScoreSize == 3) {
|
||||||
@ -2464,4 +2503,28 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PK倒计时
|
||||||
|
*/
|
||||||
|
private void pkCountdownTimer() {
|
||||||
|
|
||||||
|
mPkTimeCount--;
|
||||||
|
if (mPkTimeCount > 0) {//
|
||||||
|
if (mHandler != null) {
|
||||||
|
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
|
||||||
|
livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
||||||
|
mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME2, getNextSecondTime());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
livePushRyViewHolder.timeTitle.setVisibility(View.GONE);
|
||||||
|
if (mHandler != null) {
|
||||||
|
mHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
|
.setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT));
|
||||||
|
// endDRGif();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setViewUP(int i) {
|
public void setViewUP(int i) {
|
||||||
if (mVideoView == null) return;
|
if (mVideoView == null) return;
|
||||||
Log.e("收", "整理" + i);
|
Log.e("收", "整理" + i);
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||||
|
@ -94,6 +94,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
|
|
||||||
private ViewGroup liveActivityContainer;
|
private ViewGroup liveActivityContainer;
|
||||||
public FrameLayout timeTitle;
|
public FrameLayout timeTitle;
|
||||||
|
public TextView textTime;
|
||||||
|
|
||||||
public LivePushRyViewHolder(Context context, ViewGroup parentView) {
|
public LivePushRyViewHolder(Context context, ViewGroup parentView) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
@ -344,6 +345,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
leave = (ImageView) findViewById(R.id.leave);
|
leave = (ImageView) findViewById(R.id.leave);
|
||||||
dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view);
|
dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view);
|
||||||
timeTitle = (FrameLayout) findViewById(R.id.time_title);
|
timeTitle = (FrameLayout) findViewById(R.id.time_title);
|
||||||
|
textTime = (TextView) findViewById(R.id.text_time);
|
||||||
dr_pk_view.setVisibility(View.GONE);
|
dr_pk_view.setVisibility(View.GONE);
|
||||||
cameraPreview3.setVisibility(View.GONE);
|
cameraPreview3.setVisibility(View.GONE);
|
||||||
btn_close = (TextView) findViewById(R.id.btn_close);
|
btn_close = (TextView) findViewById(R.id.btn_close);
|
||||||
|
@ -269,7 +269,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
static RoundedImageView mic_ico1;
|
static RoundedImageView mic_ico1;
|
||||||
static RoundedImageView mic_ico2;
|
static RoundedImageView mic_ico2;
|
||||||
|
|
||||||
static GifImageView dr_pk_end_gif;
|
private GifImageView dr_pk_end_gif;
|
||||||
private SVGAImageView gift_svga;
|
private SVGAImageView gift_svga;
|
||||||
|
|
||||||
public static Handler mHandler;
|
public static Handler mHandler;
|
||||||
@ -442,11 +442,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
if (mHandler != null) {
|
if (mHandler != null) {
|
||||||
mHandler.removeCallbacksAndMessages(null);
|
mHandler.removeCallbacksAndMessages(null);
|
||||||
}
|
}
|
||||||
endDRGif();
|
// endDRGif();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void endDRGif() {
|
public void endDRGif() {
|
||||||
|
dr_pk_end_gif.setVisibility(View.VISIBLE);
|
||||||
RequestOptions options = new RequestOptions().skipMemoryCache(true);//配置
|
RequestOptions options = new RequestOptions().skipMemoryCache(true);//配置
|
||||||
Glide.with(Contexts).asGif()
|
Glide.with(Contexts).asGif()
|
||||||
.apply(options)//应用配置
|
.apply(options)//应用配置
|
||||||
|
@ -129,7 +129,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
//侧滑布局
|
//侧滑布局
|
||||||
// private DrawerLayout drawerLayout;
|
// private DrawerLayout drawerLayout;
|
||||||
//直播间拆分布局
|
//直播间拆分布局
|
||||||
private LiveRoomPlayViewHolder mLivePlayViewHolder;
|
private LivePlayRyViewHolder mLivePlayViewHolder;
|
||||||
//头部布局
|
//头部布局
|
||||||
public LiveRoomViewHolder mLiveRoomViewHolder;
|
public LiveRoomViewHolder mLiveRoomViewHolder;
|
||||||
//底部布局
|
//底部布局
|
||||||
@ -480,16 +480,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) {
|
if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) {
|
||||||
mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull);
|
mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (mLivePlayViewHolder instanceof LivePlayTxViewHolder) {
|
|
||||||
((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(true, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")) {
|
if (data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")) {
|
||||||
|
|
||||||
LivePlayRyViewHolder.setViewUP(1);
|
mLivePlayViewHolder.setViewUP(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (mLiveRoomViewHolder != null) {
|
if (mLiveRoomViewHolder != null) {
|
||||||
@ -497,7 +493,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了
|
if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了
|
||||||
|
|
||||||
LivePlayRyViewHolder.setViewUP(2);
|
mLivePlayViewHolder.setViewUP(2);
|
||||||
|
|
||||||
//pk排名数据
|
//pk排名数据
|
||||||
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
||||||
@ -511,7 +507,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRoomViewHolder.pkHandler = true;
|
mLiveRoomViewHolder.pkHandler = true;
|
||||||
mLiveRoomViewHolder.initPkRank(null);
|
mLiveRoomViewHolder.initPkRank(null);
|
||||||
}
|
}
|
||||||
LivePlayRyViewHolder.setViewUP(3);
|
mLivePlayViewHolder.setViewUP(3);
|
||||||
|
|
||||||
//pk排名数据
|
//pk排名数据
|
||||||
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
||||||
@ -526,7 +522,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
if (mLiveRoomViewHolder != null) {
|
if (mLiveRoomViewHolder != null) {
|
||||||
mLiveRoomViewHolder.initPkRank(null);
|
mLiveRoomViewHolder.initPkRank(null);
|
||||||
}
|
}
|
||||||
LivePlayRyViewHolder.setViewUP(4);
|
mLivePlayViewHolder.setViewUP(4);
|
||||||
|
|
||||||
mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time"));
|
mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time"));
|
||||||
}
|
}
|
||||||
@ -736,7 +732,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
MicStatusManager.getInstance().removeOnMicListener(micStatusListener);
|
MicStatusManager.getInstance().removeOnMicListener(micStatusListener);
|
||||||
mContext = null;//上下文置空防止内存泄漏
|
mContext = null;//上下文置空防止内存泄漏
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1563,9 +1559,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
|
|
||||||
public void onLinkMicTxAccEvent(LinkMicTxAccEvent e) {
|
public void onLinkMicTxAccEvent(LinkMicTxAccEvent e) {
|
||||||
if (mLivePlayViewHolder != null && mLivePlayViewHolder instanceof LivePlayTxViewHolder) {
|
|
||||||
((LivePlayTxViewHolder) mLivePlayViewHolder).onLinkMicTxAccEvent(e.isLinkMic());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1574,9 +1568,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
* @param linkMic true开始连麦 false断开连麦
|
* @param linkMic true开始连麦 false断开连麦
|
||||||
*/
|
*/
|
||||||
public void onLinkMicTxAnchor(boolean linkMic) {
|
public void onLinkMicTxAnchor(boolean linkMic) {
|
||||||
if (mLivePlayViewHolder != null && mLivePlayViewHolder instanceof LivePlayTxViewHolder) {
|
|
||||||
((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(linkMic, 5000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,6 +47,9 @@
|
|||||||
android:layout_marginStart="5.33dp"
|
android:layout_marginStart="5.33dp"
|
||||||
android:layout_marginTop="3.3dp"
|
android:layout_marginTop="3.3dp"
|
||||||
android:background="@drawable/background_pk_time"
|
android:background="@drawable/background_pk_time"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxEms="6"
|
||||||
|
android:maxLines="1"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:paddingTop="4.33dp"
|
android:paddingTop="4.33dp"
|
||||||
android:paddingEnd="6dp"
|
android:paddingEnd="6dp"
|
||||||
@ -102,6 +105,9 @@
|
|||||||
android:layout_marginTop="3.3dp"
|
android:layout_marginTop="3.3dp"
|
||||||
android:layout_marginEnd="5.33dp"
|
android:layout_marginEnd="5.33dp"
|
||||||
android:background="@drawable/background_pk_time"
|
android:background="@drawable/background_pk_time"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxEms="6"
|
||||||
|
android:maxLines="1"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:paddingTop="4.33dp"
|
android:paddingTop="4.33dp"
|
||||||
android:paddingEnd="6dp"
|
android:paddingEnd="6dp"
|
||||||
@ -126,6 +132,9 @@
|
|||||||
android:layout_marginStart="5.33dp"
|
android:layout_marginStart="5.33dp"
|
||||||
android:layout_marginBottom="3.3dp"
|
android:layout_marginBottom="3.3dp"
|
||||||
android:background="@drawable/background_pk_time"
|
android:background="@drawable/background_pk_time"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxEms="6"
|
||||||
|
android:maxLines="1"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:paddingTop="4.33dp"
|
android:paddingTop="4.33dp"
|
||||||
android:paddingEnd="6dp"
|
android:paddingEnd="6dp"
|
||||||
@ -181,6 +190,9 @@
|
|||||||
android:layout_marginEnd="5.33dp"
|
android:layout_marginEnd="5.33dp"
|
||||||
android:layout_marginBottom="3.3dp"
|
android:layout_marginBottom="3.3dp"
|
||||||
android:background="@drawable/background_pk_time"
|
android:background="@drawable/background_pk_time"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxEms="6"
|
||||||
|
android:maxLines="1"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:paddingTop="4.33dp"
|
android:paddingTop="4.33dp"
|
||||||
android:paddingEnd="6dp"
|
android:paddingEnd="6dp"
|
||||||
|
@ -183,6 +183,7 @@
|
|||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/text_time"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
@ -1541,12 +1541,6 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<pl.droidsonroids.gif.GifImageView
|
|
||||||
android:id="@+id/dr_pk_end_gif"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_centerVertical="true" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -2282,4 +2276,14 @@
|
|||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:visibility="visible" />
|
android:visibility="visible" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<pl.droidsonroids.gif.GifImageView
|
||||||
|
android:id="@+id/dr_pk_end_gif"
|
||||||
|
android:layout_width="140dp"
|
||||||
|
android:layout_height="140dp"
|
||||||
|
android:layout_marginTop="160dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_centerVertical="false"
|
||||||
|
android:src="@mipmap/drpkend"
|
||||||
|
android:visibility="gone" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user