add[声望升级-多人PK]
This commit is contained in:
parent
9320d6c209
commit
7d46ab8520
@ -154,6 +154,26 @@ public class SWAuManager extends BaseCacheManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 与主播连麦
|
||||
* @param isUp true 上麦 false 下麦
|
||||
*/
|
||||
public void setMicAn(boolean isUp) {
|
||||
L.eSw("setMicAn-isUp:"+isUp);
|
||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||
if(isUp){
|
||||
options.publishCameraTrack = false; //控制是否发视频
|
||||
options.publishMicrophoneTrack = true; //控制是否发音频
|
||||
options.clientRoleType = Constants.CLIENT_ROLE_BROADCASTER; //设置身份为主播
|
||||
}else{
|
||||
options.publishCameraTrack = false; //控制是否发视频
|
||||
options.publishMicrophoneTrack = false; //控制是否发音频
|
||||
options.clientRoleType = Constants.CLIENT_ROLE_AUDIENCE; //设置身份为观众
|
||||
options.audienceLatencyLevel=Constants.AUDIENCE_LATENCY_LEVEL_LOW_LATENCY ;//设置为极速直播观众
|
||||
}
|
||||
mRtcEngine.updateChannelMediaOptions(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* PK-加入对方主播直播间
|
||||
* @param strUid
|
||||
@ -272,4 +292,5 @@ public class SWAuManager extends BaseCacheManager {
|
||||
public void setLinkUserContainer(FrameLayout linkUserContainer) {
|
||||
this.linkUserContainer = linkUserContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -557,6 +557,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
*/
|
||||
@Override
|
||||
public void onAnchorAcceptLinkMic() {
|
||||
L.eSw("onAnchorAcceptLinkMic(1)");
|
||||
if (mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.onAnchorAcceptLinkMic();
|
||||
}
|
||||
|
@ -313,6 +313,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
* 所有人收到连麦观众发过来的播流地址的回调
|
||||
*/
|
||||
public void onAudienceSendLinkMicUrl(String uid, String uname, String playUrl) {
|
||||
L.eSw("onAudienceSendLinkMicUrl,主播同意");
|
||||
if (TextUtils.isEmpty(uid)) {
|
||||
return;
|
||||
}
|
||||
|
@ -522,26 +522,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
if (livePushRyViewHolder != null) {
|
||||
livePushRyViewHolder.setAnDrPkRtc(String.valueOf(u.getId()), -1);
|
||||
}
|
||||
HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", CommonAppConfig.getInstance().getUid()).execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(info.length>0){
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class);
|
||||
int removeIndex = -1;
|
||||
for (int i = 0; i < drPkbeans.size(); i++) {
|
||||
if (CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
removeIndex = i;
|
||||
}
|
||||
}
|
||||
if (removeIndex != -1) {
|
||||
drPkbeans.remove(removeIndex);
|
||||
L.eSw("将自己从多人pk列表里剔除" + new Gson().toJson(drPkbeans));
|
||||
}
|
||||
dRjoinOtherRoom(drPkbeans);
|
||||
}
|
||||
}
|
||||
});
|
||||
dRjoinOtherRoom(u);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1076,7 +1057,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
}
|
||||
}
|
||||
dRjoinOtherRoom(drPkbeans);
|
||||
dRjoinOtherRoom(u);
|
||||
|
||||
/*for (int i = 0; i < users.size(); i++) {
|
||||
JSONObject user = users.getJSONObject(i);
|
||||
@ -1219,219 +1200,121 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void setMyDrPkDetailsView(){
|
||||
detailsView1 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout1 = detailsView1.findViewById(R.id.lin_pk1);
|
||||
linearGrade1 = detailsView1.findViewById(R.id.linear_grade1);
|
||||
imageGrade1 = detailsView1.findViewById(R.id.image_grade1);
|
||||
textGrade1 = detailsView1.findViewById(R.id.text_grade1);
|
||||
textPkName1 = detailsView1.findViewById(R.id.text_pk_name1);
|
||||
imageGrade1.setTag(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
livePushRyViewHolder.dr1_preview.addView(detailsView1);
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
linearGrade1.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
boolean isShow = false;
|
||||
|
||||
//多人PK接受申请画 加入副房间
|
||||
public void dRjoinOtherRoom(List<DrPkbean> drPkbeanList) {
|
||||
L.eSw("dRjoinOtherRoom:size:" + drPkbeanList.size() + " json " + new Gson().toJson(drPkbeanList));
|
||||
if (drPkbeanList.size() == 1) {
|
||||
String uid = String.valueOf(drPkbeanList.get(0).getId());
|
||||
//设置多人PK数据
|
||||
LiveNetManager.get(mContext).getLiveInfo(uid, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveInfoModel data) {
|
||||
if(detailsView2!=null){
|
||||
livePushRyViewHolder.dr2_preview.removeView(detailsView2);
|
||||
}
|
||||
detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2);
|
||||
linearGrade2 = detailsView2.findViewById(R.id.linear_grade2);
|
||||
textPkName2 = detailsView2.findViewById(R.id.text_pk_name2);
|
||||
imageGrade2 = detailsView2.findViewById(R.id.image_grade2);
|
||||
textGrade2 = detailsView2.findViewById(R.id.text_grade2);
|
||||
imageGrade2.setTag(uid);
|
||||
textPkName2.setText(data.getUserNicename());
|
||||
livePushRyViewHolder.dr2_preview.addView(detailsView2);
|
||||
detailsLinearLayout2.setVisibility(View.VISIBLE);
|
||||
linearGrade2.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
|
||||
detailsView1 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout1 = detailsView1.findViewById(R.id.lin_pk1);
|
||||
linearGrade1 = detailsView1.findViewById(R.id.linear_grade1);
|
||||
imageGrade1 = detailsView1.findViewById(R.id.image_grade1);
|
||||
textGrade1 = detailsView1.findViewById(R.id.text_grade1);
|
||||
textPkName1 = detailsView1.findViewById(R.id.text_pk_name1);
|
||||
imageGrade1.setTag(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
livePushRyViewHolder.dr1_preview.addView(detailsView1);
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
linearGrade1.setVisibility(View.GONE);
|
||||
|
||||
|
||||
Log.e("ry", "多人接受成功" + uid);
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
|
||||
} else if (drPkbeanList.size() == 2) {
|
||||
String uid1 = String.valueOf(drPkbeanList.get(0).getId());
|
||||
String uid2 = String.valueOf(drPkbeanList.get(1).getId());
|
||||
//设置多人PK数据
|
||||
LiveNetManager.get(mContext).getLiveInfo(uid1, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveInfoModel data) {
|
||||
if(detailsView2!=null){
|
||||
livePushRyViewHolder.dr2_preview.removeView(detailsView2);
|
||||
}
|
||||
detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2);
|
||||
linearGrade2 = detailsView2.findViewById(R.id.linear_grade2);
|
||||
textPkName2 = detailsView2.findViewById(R.id.text_pk_name2);
|
||||
imageGrade2 = detailsView2.findViewById(R.id.image_grade2);
|
||||
textGrade2 = detailsView2.findViewById(R.id.text_grade2);
|
||||
imageGrade2.setTag(uid1);
|
||||
textPkName2.setText(data.getUserNicename());
|
||||
livePushRyViewHolder.dr2_preview.addView(detailsView2);
|
||||
detailsLinearLayout2.setVisibility(View.VISIBLE);
|
||||
linearGrade2.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
|
||||
detailsView1 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout1 = detailsView1.findViewById(R.id.lin_pk1);
|
||||
linearGrade1 = detailsView1.findViewById(R.id.linear_grade1);
|
||||
imageGrade1 = detailsView1.findViewById(R.id.image_grade1);
|
||||
textGrade1 = detailsView1.findViewById(R.id.text_grade1);
|
||||
textPkName1 = detailsView1.findViewById(R.id.text_pk_name1);
|
||||
imageGrade1.setTag(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
livePushRyViewHolder.dr1_preview.addView(detailsView1);
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
linearGrade1.setVisibility(View.GONE);
|
||||
|
||||
LiveNetManager.get(mContext).getLiveInfo(uid2, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveInfoModel data) {
|
||||
if(detailsView4!=null){
|
||||
livePushRyViewHolder.dr4_preview.removeView(detailsView4);
|
||||
}
|
||||
detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4);
|
||||
linearGrade4 = detailsView4.findViewById(R.id.linear_grade4);
|
||||
textPkName4 = detailsView4.findViewById(R.id.text_pk_name4);
|
||||
imageGrade4 = detailsView4.findViewById(R.id.image_grade4);
|
||||
textGrade4 = detailsView4.findViewById(R.id.text_grade4);
|
||||
imageGrade4.setTag(uid2);
|
||||
textPkName4.setText(data.getUserNicename());
|
||||
livePushRyViewHolder.dr4_preview.addView(detailsView4);
|
||||
detailsLinearLayout4.setVisibility(View.VISIBLE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
L.eSw("第三个主播的名称 数据加载完成"+detailsLinearLayout4.getVisibility());
|
||||
L.eSw("detailsLinearLayout4.getVisibility()"+detailsLinearLayout4.getVisibility());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
|
||||
} else if (drPkbeanList.size() == 3) {
|
||||
String uid1 = String.valueOf(drPkbeanList.get(0).getId());
|
||||
String uid2 = String.valueOf(drPkbeanList.get(1).getId());
|
||||
String uid3 = String.valueOf(drPkbeanList.get(2).getId());
|
||||
//设置多人PK数据
|
||||
LiveNetManager.get(mContext).getLiveInfo(uid1, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveInfoModel data) {
|
||||
if(detailsView2!=null){
|
||||
livePushRyViewHolder.dr2_preview.removeView(detailsView2);
|
||||
}
|
||||
detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2);
|
||||
linearGrade2 = detailsView2.findViewById(R.id.linear_grade2);
|
||||
textPkName2 = detailsView2.findViewById(R.id.text_pk_name2);
|
||||
imageGrade2 = detailsView2.findViewById(R.id.image_grade2);
|
||||
textGrade2 = detailsView2.findViewById(R.id.text_grade2);
|
||||
imageGrade2.setTag(uid1);
|
||||
textPkName2.setText(data.getUserNicename());
|
||||
livePushRyViewHolder.dr2_preview.addView(detailsView2);
|
||||
detailsLinearLayout2.setVisibility(View.VISIBLE);
|
||||
linearGrade2.setVisibility(View.GONE);
|
||||
L.eSw("detailsLinearLayout2.getVisibility()"+detailsLinearLayout2.getVisibility());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
|
||||
detailsView1 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout1 = detailsView1.findViewById(R.id.lin_pk1);
|
||||
linearGrade1 = detailsView1.findViewById(R.id.linear_grade1);
|
||||
imageGrade1 = detailsView1.findViewById(R.id.image_grade1);
|
||||
textGrade1 = detailsView1.findViewById(R.id.text_grade1);
|
||||
textPkName1 = detailsView1.findViewById(R.id.text_pk_name1);
|
||||
imageGrade1.setTag(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
livePushRyViewHolder.dr1_preview.addView(detailsView1);
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
linearGrade1.setVisibility(View.GONE);
|
||||
|
||||
LiveNetManager.get(mContext).getLiveInfo(uid2, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveInfoModel data) {
|
||||
if(detailsView2!=null){
|
||||
livePushRyViewHolder.dr3_preview.removeView(detailsView3);
|
||||
}
|
||||
detailsView3 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout3 = detailsView3.findViewById(R.id.lin_pk3);
|
||||
linearGrade3 = detailsView3.findViewById(R.id.linear_grade3);
|
||||
textPkName3 = detailsView3.findViewById(R.id.text_pk_name3);
|
||||
imageGrade3 = detailsView3.findViewById(R.id.image_grade3);
|
||||
textGrade3 = detailsView3.findViewById(R.id.text_grade3);
|
||||
imageGrade3.setTag(uid2);
|
||||
textPkName3.setText(data.getUserNicename());
|
||||
livePushRyViewHolder.dr3_preview.addView(detailsView3);
|
||||
detailsLinearLayout3.setVisibility(View.VISIBLE);
|
||||
linearGrade3.setVisibility(View.GONE);
|
||||
L.eSw("detailsLinearLayout3.getVisibility()"+detailsLinearLayout3.getVisibility());
|
||||
L.eSw("第三个主播的名称 数据加载完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
LiveNetManager.get(mContext).getLiveInfo(uid3, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveInfoModel data) {
|
||||
if(detailsView4!=null){
|
||||
livePushRyViewHolder.dr4_preview.removeView(detailsView4);
|
||||
}
|
||||
detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4);
|
||||
linearGrade4 = detailsView4.findViewById(R.id.linear_grade4);
|
||||
textPkName4 = detailsView4.findViewById(R.id.text_pk_name4);
|
||||
imageGrade4 = detailsView4.findViewById(R.id.image_grade4);
|
||||
textGrade4 = detailsView4.findViewById(R.id.text_grade4);
|
||||
imageGrade4.setTag(uid3);
|
||||
textPkName4.setText(data.getUserNicename());
|
||||
livePushRyViewHolder.dr4_preview.addView(detailsView4);
|
||||
detailsLinearLayout4.setVisibility(View.VISIBLE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
L.eSw("detailsLinearLayout4.getVisibility()"+detailsLinearLayout4.getVisibility());
|
||||
L.eSw("第四个主播的名称 数据加载完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
|
||||
Log.e("ry", "多人接受成功" + mApplyUid);
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
|
||||
|
||||
}
|
||||
public void dRjoinOtherRoom(UserBean u) {
|
||||
if(!isShow){
|
||||
setMyDrPkDetailsView();
|
||||
isShow = true;
|
||||
}
|
||||
HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", u.getId()).execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info.length > 0) {
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class);
|
||||
int removeIndex = -1;
|
||||
for (int i = 0; i < drPkbeans.size(); i++) {
|
||||
if (CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
removeIndex = i;
|
||||
}
|
||||
}
|
||||
if (removeIndex != -1) {
|
||||
drPkbeans.remove(removeIndex);
|
||||
L.eSw("将自己从多人pk列表里剔除" + new Gson().toJson(drPkbeans));
|
||||
}
|
||||
setDrPkUserInfoView(drPkbeans);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setDrPkUserInfoView(List<DrPkbean> drPkbeanList) {
|
||||
for (int j = 0; j <drPkbeanList.size(); j++) {
|
||||
if (j == 0) {
|
||||
//设置多人PK数据
|
||||
if (detailsView2 != null) {
|
||||
livePushRyViewHolder.dr2_preview.removeView(detailsView2);
|
||||
}
|
||||
detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2);
|
||||
linearGrade2 = detailsView2.findViewById(R.id.linear_grade2);
|
||||
textPkName2 = detailsView2.findViewById(R.id.text_pk_name2);
|
||||
imageGrade2 = detailsView2.findViewById(R.id.image_grade2);
|
||||
textGrade2 = detailsView2.findViewById(R.id.text_grade2);
|
||||
imageGrade2.setTag(String.valueOf(drPkbeanList.get(0).getId()));
|
||||
textPkName2.setText(drPkbeanList.get(0).getUser_nicename());
|
||||
livePushRyViewHolder.dr2_preview.addView(detailsView2);
|
||||
detailsLinearLayout2.setVisibility(View.VISIBLE);
|
||||
linearGrade2.setVisibility(View.GONE);
|
||||
} else if (j == 1) {
|
||||
if (detailsView4 != null) {
|
||||
livePushRyViewHolder.dr4_preview.removeView(detailsView4);
|
||||
}
|
||||
detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4);
|
||||
linearGrade4 = detailsView4.findViewById(R.id.linear_grade4);
|
||||
textPkName4 = detailsView4.findViewById(R.id.text_pk_name4);
|
||||
imageGrade4 = detailsView4.findViewById(R.id.image_grade4);
|
||||
textGrade4 = detailsView4.findViewById(R.id.text_grade4);
|
||||
imageGrade4.setTag(String.valueOf(drPkbeanList.get(1).getId()));
|
||||
textPkName4.setText(drPkbeanList.get(1).getUser_nicename());
|
||||
livePushRyViewHolder.dr4_preview.addView(detailsView4);
|
||||
detailsLinearLayout4.setVisibility(View.VISIBLE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
} else if (j == 2) {
|
||||
//设置多人PK数据
|
||||
if (detailsView3 != null) {
|
||||
livePushRyViewHolder.dr3_preview.removeView(detailsView3);
|
||||
}
|
||||
detailsView3 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout3 = detailsView3.findViewById(R.id.lin_pk3);
|
||||
linearGrade3 = detailsView3.findViewById(R.id.linear_grade3);
|
||||
textPkName3 = detailsView3.findViewById(R.id.text_pk_name3);
|
||||
imageGrade3 = detailsView3.findViewById(R.id.image_grade3);
|
||||
textGrade3 = detailsView3.findViewById(R.id.text_grade3);
|
||||
imageGrade3.setTag(String.valueOf(drPkbeanList.get(1).getId()));
|
||||
textPkName3.setText(drPkbeanList.get(1).getUser_nicename());
|
||||
livePushRyViewHolder.dr3_preview.addView(detailsView3);
|
||||
detailsLinearLayout3.setVisibility(View.VISIBLE);
|
||||
linearGrade3.setVisibility(View.GONE);
|
||||
|
||||
if (detailsView4 != null) {
|
||||
livePushRyViewHolder.dr4_preview.removeView(detailsView4);
|
||||
}
|
||||
detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4);
|
||||
linearGrade4 = detailsView4.findViewById(R.id.linear_grade4);
|
||||
textPkName4 = detailsView4.findViewById(R.id.text_pk_name4);
|
||||
imageGrade4 = detailsView4.findViewById(R.id.image_grade4);
|
||||
textGrade4 = detailsView4.findViewById(R.id.text_grade4);
|
||||
imageGrade4.setTag(String.valueOf(drPkbeanList.get(2).getId()));
|
||||
textPkName4.setText(drPkbeanList.get(2).getUser_nicename());
|
||||
livePushRyViewHolder.dr4_preview.addView(detailsView4);
|
||||
detailsLinearLayout4.setVisibility(View.VISIBLE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
|
||||
|
||||
}
|
||||
}
|
||||
L.eSw("dRjoinOtherRoom:size:" + drPkbeanList.size() + " json " + new Gson().toJson(drPkbeanList));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 多人PK PK主播发过来的已经接受
|
||||
@ -1448,7 +1331,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
* @group 房间管理
|
||||
*/
|
||||
|
||||
RCRTCEngine.getInstance().joinOtherRoom(u, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
|
||||
/*RCRTCEngine.getInstance().joinOtherRoom(u, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
|
||||
@Override
|
||||
public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) {
|
||||
rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener);
|
||||
@ -1622,7 +1505,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
public void onFailed(RTCErrorCode rtcErrorCode) {
|
||||
Log.i("ry", "加入其他房间失败 :" + rtcErrorCode.getReason());
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -196,6 +196,7 @@ public class SocketRyClient {
|
||||
//用户连麦
|
||||
case Constants.LIAN_MAI:
|
||||
int actions = map.getIntValue("action");
|
||||
L.eSw("用户连麦:actions"+actions);
|
||||
//主播邀请用户连麦消息
|
||||
if (actions == 1) {
|
||||
EventBus.getDefault().post("inviteMic");
|
||||
@ -215,6 +216,8 @@ public class SocketRyClient {
|
||||
EventBus.getDefault().post("endMic");
|
||||
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CLOSE).setObject(map.toJavaObject(LinkMicUserBean.class)));
|
||||
} else if (actions == 8) {
|
||||
//踢下麥
|
||||
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("您已被移出多人語音連麥");
|
||||
} else {
|
||||
@ -449,7 +452,7 @@ public class SocketRyClient {
|
||||
case Constants.SOCKET_BUY_GUARD://购买守护
|
||||
buyGuardInSameRoom(map);
|
||||
break;
|
||||
case Constants.SOCKET_LINK_MIC://连麦
|
||||
case Constants.SOCKET_LINK_MIC://连麦-old
|
||||
processLinkMic(map);
|
||||
break;
|
||||
case Constants.SOCKET_LINK_MIC_ANCHOR://主播连麦
|
||||
|
@ -280,6 +280,29 @@ boolean isAdd = true;
|
||||
swAuManager.updateMyChannelView((FrameLayout) ry_view, Integer.parseInt(liveUid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将用户设置成主播,与主播连麦
|
||||
*/
|
||||
private void joinLiveMic() {
|
||||
L.eSw("joinLiveMic");
|
||||
HttpClient.getInstance().get("live.joinDrLm", "live.joinDrLm")
|
||||
.params("roomid", LiveActivity.mLiveUid)
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.e("ry", code + "热热热");
|
||||
if(code==0){
|
||||
swAuManager.setMicAn(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void endLiveMic() {
|
||||
L.eSw("endLiveMic");
|
||||
swAuManager.setMicAn(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideCover() {
|
||||
// if (mCover != null) {
|
||||
@ -767,8 +790,10 @@ boolean isAdd = true;
|
||||
LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UsertoRY();
|
||||
|
||||
//UsertoRY();
|
||||
//将自己设置成给主播,和主播连麦
|
||||
L.eSw("将自己设置成给主播,和主播连麦");
|
||||
joinLiveMic();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -776,75 +801,10 @@ boolean isAdd = true;
|
||||
builder.build().show();
|
||||
|
||||
} else if ("endMic".equals(str)) {
|
||||
if (rcrtcRoom != null) {
|
||||
L.eSw("endMic.equals(str))"+str);
|
||||
// 开始切换为观众身份
|
||||
RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
|
||||
|
||||
/**
|
||||
* 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
|
||||
* SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
|
||||
*/
|
||||
@Override
|
||||
public void onKicked() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry", "下麦成功");
|
||||
// 该用户切换为观众成功,可以以观众身份进行音视频
|
||||
//退出rtc播放
|
||||
leaveRoom();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当切换失败且不影响当前角色继续音视频时回调
|
||||
* @param errorCode 失败错误码
|
||||
*/
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry", "下麦失败" + errorCode);
|
||||
leaveRoom();
|
||||
}
|
||||
|
||||
private void leaveRoom() {
|
||||
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
userJoinLinkMic = false;
|
||||
Log.e("ry", "退出多人房间成功");
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("已成功退出語音連麥");
|
||||
} else {
|
||||
ToastUtil.show("You have successfully exited the voice connection");
|
||||
}
|
||||
ry_view.removeAllViews();
|
||||
ry_view.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
onPrepared();
|
||||
rcrtcRoom = null;
|
||||
MicStatusManager.getInstance().clear();
|
||||
|
||||
resumePlay();
|
||||
|
||||
if (onMicCallback != null) {
|
||||
onMicCallback.onMikUpdate();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry", errorCode + "退出多人房间成功");
|
||||
userJoinLinkMic = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//声网-将用户身份切换只观众
|
||||
endLiveMic();
|
||||
} else if ("Debug".equals(str)) {
|
||||
if (EasyFloat.isShow("Debug")) {
|
||||
EasyFloat.dismiss("Debug");
|
||||
|
@ -605,6 +605,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
|
||||
private String drpkUid3 = "";
|
||||
public int setAnDrPkRtc(String uid, int position) {
|
||||
L.eSw("setAnDrPkRtc uid:"+uid+" position"+position);
|
||||
FrameLayout frameLayout = null;
|
||||
int temp= -1;
|
||||
if (swManager != null && !StringUtil.isEmpty(uid)) {
|
||||
@ -630,7 +631,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
break;
|
||||
case 4:
|
||||
dr3_preview.setVisibility(View.VISIBLE);
|
||||
//先退出这个主播的直播间,在进入该直播间,(视图问题暂时找不到解决方案)
|
||||
//先退出这个主播的直播间,在进入该直播间,(视图问题暂时這樣處理)
|
||||
swManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()),drpkUid3);
|
||||
swManager.joinChannelDrEx(dr3_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, drpkUid3, SWAuManager.getChannelName(drpkUid3));
|
||||
|
||||
|
@ -51,6 +51,7 @@ import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.ms.banner.Banner;
|
||||
@ -124,6 +125,7 @@ import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
@ -5272,9 +5274,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
};
|
||||
|
||||
public void upDataPkScore(JSONArray pkScores, int time) {
|
||||
L.eSw("upDataPkScore(JSONArray pkScores, int time) {"+new Gson().toJson(pkScores));
|
||||
isShowGif = true;
|
||||
if (detailsView == null) {
|
||||
detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
/*if (detailsView == null) {
|
||||
L.eSw("upDataPkScore(JSONArray pkScores, int time) {detailsView=null");
|
||||
detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||
timeTitle = detailsView.findViewById(R.id.time_title);
|
||||
textTime = detailsView.findViewById(R.id.text_time);
|
||||
linearGrade1 = detailsView.findViewById(R.id.lin_pk1);
|
||||
@ -5293,7 +5297,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
imageGrade2 = detailsView.findViewById(R.id.image_grade2);
|
||||
imageGrade3 = detailsView.findViewById(R.id.image_grade3);
|
||||
imageGrade4 = detailsView.findViewById(R.id.image_grade4);
|
||||
linearGrade1.setVisibility(View.GONE);
|
||||
//暂时关闭
|
||||
linearGrade1.setVisibility(View.GONE);
|
||||
linearGrade2.setVisibility(View.GONE);
|
||||
linearGrade3.setVisibility(View.GONE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
@ -5311,7 +5316,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
detailsView.setLayoutParams(params);
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
if (time > 0) {
|
||||
mPkTimeCount2 = time;
|
||||
drPKtIME = time;
|
||||
|
@ -641,10 +641,21 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mLivePlayViewHolder != null && data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")) {
|
||||
//mLivePlayViewHolder.setViewUP(1);
|
||||
mLivePlayViewHolder.setPkView(data.getEnterRoomInfo().getPkinfo().getPkuid());
|
||||
if(mLivePlayViewHolder != null && data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")){
|
||||
JSONArray array = pkInfo.getJSONArray("userlist");
|
||||
//判断是否是多人连麦
|
||||
if(array!=null){//多人連麥
|
||||
if (mLivePlayViewHolder != null) {
|
||||
for (int j = 0; j < array.size(); j++) {
|
||||
UserBean drPkbean = new UserBean();
|
||||
JSONObject da = array.getJSONObject(j);
|
||||
drPkbean.setId(String.valueOf(da.getIntValue("id")));
|
||||
mLivePlayViewHolder.setDrMicInfo(drPkbean);
|
||||
}
|
||||
}
|
||||
}else{//单人连麦
|
||||
mLivePlayViewHolder.setPkView(data.getEnterRoomInfo().getPkinfo().getPkuid());
|
||||
}
|
||||
}
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.pkHandler = false;
|
||||
@ -1478,7 +1489,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
@Override
|
||||
public void onAudienceApplyLinkMic(UserBean u) {
|
||||
|
||||
L.eSw("onAudienceApplyLinkMic(2)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2162,7 +2173,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
* @param time
|
||||
*/
|
||||
public void upDataPkScore(JSONArray pkScores, int time) {
|
||||
|
||||
L.eSw("upDataPkScore"+time);
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
String liveId = mLiveBean.getUid();
|
||||
JSONObject liveModel = null;
|
||||
|
Loading…
Reference in New Issue
Block a user