diff --git a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java
index 775696051..1c1fdea91 100644
--- a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java
+++ b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java
@@ -184,6 +184,36 @@ public class SWManager extends BaseCacheManager {
}
}
+
+ public void setDrPkNumClarity(int selectClarity) {
+ if (cfg != null && mRtcEngine != null) {
+ VideoEncoderConfiguration.VideoDimensions videoDimensions = new VideoEncoderConfiguration.VideoDimensions();
+ switch (selectClarity) {
+ case 1:
+ videoDimensions.width = 720;
+ videoDimensions.height = 1280;
+ cfg.dimensions = videoDimensions;
+ break;
+ case 2:
+ case 3:
+ videoDimensions.width = 360;
+ videoDimensions.height = 640;
+ cfg.dimensions = videoDimensions;
+ break;
+ case 4:
+ videoDimensions.width = 360;
+ videoDimensions.height = 320;
+ cfg.dimensions = videoDimensions;
+ break;
+ }
+ mRtcEngine.setVideoEncoderConfiguration(cfg);
+ }
+ }
+
+
+
+
+
/**
* 设置镜像模式
*/
diff --git a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java
index 01e860dd1..b958b1432 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java
@@ -123,6 +123,7 @@ import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.base.RCRTCRect;
import cn.rongcloud.rtc.base.RTCErrorCode;
+import io.agora.beautyapi.faceunity.agora.SWManager;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
@@ -1656,6 +1657,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.endDRGif();
}
}
+ SWManager.get().setDrPkNumClarity(1);
// if (mLiveRoomViewHolder != null) {
// mLiveRoomViewHolder.hotAddVisibility(false);
// }
diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java
index 6909894a4..1c167b617 100644
--- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java
+++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java
@@ -374,18 +374,13 @@ public class LiveGiftAnimPresenter {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
- Bus.get().post(new LiveAudienceEvent()
- .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
- .setmLiveUid(mLiveUid)
- .setmStream(mStream)
- .setmWishGiftId(blindBox.getEvent().getBlindBoxId() + "")
- .setIsContactGift(true));
+ Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP).setmLiveUid(mLiveUid).setmStream(mStream).setmWishGiftId(blindBox.getEvent().getBlindBoxId() + "").setIsContactGift(true));
}
}, 1000);
} else {
- if (mIvLook.getTag()!=null&&mIvLook.getTag()instanceof LiveReceiveGiftBean){
+ if (mIvLook.getTag() != null && mIvLook.getTag() instanceof LiveReceiveGiftBean) {
changeLiveRoom((LiveReceiveGiftBean) mIvLook.getTag());
- }else {
+ } else {
changeLiveRoom();
}
@@ -436,6 +431,7 @@ public class LiveGiftAnimPresenter {
}
});
}
+
private void changeLiveRoom(LiveReceiveGiftBean mTempGifGiftBean) {
if (mTempGifGiftBean != null) {
String uid = mTempGifGiftBean.getUid();
@@ -459,7 +455,7 @@ public class LiveGiftAnimPresenter {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
- public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
+ public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
if (liveBean == null) {
return;
}
@@ -503,7 +499,7 @@ public class LiveGiftAnimPresenter {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
- public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
+ public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
if (liveBean == null) {
return;
}
@@ -657,6 +653,16 @@ public class LiveGiftAnimPresenter {
});
}
+
+ /**
+ * 釋放全局通知
+ */
+ public void releaseServiceNotice() {
+ L.eSw("releaseServiceNotice 釋放全局通知");
+ mHandler.sendEmptyMessageDelayed(full_service_notice_new_1, 100);
+ full_service_notice_new.setVisibility(View.GONE);
+ }
+
private void setGitTipAnimatorBuyZuoji() {
mDp500 = DpUtil.dp2px(500);
mGifGiftTipShowAnimatorBuyZuoji = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyZuoji, "translationX", mDp500, 0);
@@ -1003,8 +1009,7 @@ public class LiveGiftAnimPresenter {
}
}
} else {
- if ((bean.getGifUrl().contains("svga") || bean.getGifUrl().contains("gif")) &&
- IMLoginManager.get(mContext).isGiftEffect()) {
+ if ((bean.getGifUrl().contains("svga") || bean.getGifUrl().contains("gif")) && IMLoginManager.get(mContext).isGiftEffect()) {
//同一直播间,玩家自己送礼物,也能看到全服通知
//同一直播间,其他玩家也能看到全服通知
@@ -1159,6 +1164,7 @@ public class LiveGiftAnimPresenter {
mRoomNum = event.getLiveuid();
if (mShowAllServer) {
+ L.eSw("mGifAll != null");
if (mGifAll != null) {
LiveReceiveGiftBean bean = new LiveReceiveGiftBean();
bean.setSendtype(91);
@@ -1167,6 +1173,7 @@ public class LiveGiftAnimPresenter {
mGifAll.offer(bean);
}
} else {
+ L.eSw("mGifAll != nullnullnullnullnullnull");
notifyFFGGGDJANEvent = event;
mShowAllServer = true;
index4Guard = getFirstIndexOfValue(heightOffsetArr, 0);
@@ -1264,23 +1271,17 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyGuardNew.setVisibility(View.VISIBLE);
switch (event.getGuardType()) {
case "1":
- guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ?
- R.mipmap.background_all_server_notify_star_zh :
- R.mipmap.background_all_server_notify_star_en);
+ guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_star_zh : R.mipmap.background_all_server_notify_star_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#072A93"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_star_guard_onlookers);
break;
case "2":
- guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ?
- R.mipmap.background_all_server_notify_king_zh :
- R.mipmap.background_all_server_notify_king_en);
+ guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_king_zh : R.mipmap.background_all_server_notify_king_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#BF0B0A"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_king_guard_onlookers);
break;
case "3":
- guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ?
- R.mipmap.background_all_server_notify_god_zh :
- R.mipmap.background_all_server_notify_sgod_en);
+ guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_god_zh : R.mipmap.background_all_server_notify_sgod_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#41057E"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_god_guard_onlookers);
break;
@@ -1333,13 +1334,7 @@ public class LiveGiftAnimPresenter {
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
if (!TextUtils.isEmpty(notifyFFGGGDJANEvent.getLink())) {
StringBuffer htmlUrl = new StringBuffer();
- htmlUrl.append(notifyFFGGGDJANEvent.getLink())
- .append(notifyFFGGGDJANEvent.getLink().contains("?") ? "&uid=" : "?uid=")
- .append(userInfo.getId())
- .append("&token=")
- .append(userInfo.getToken())
- .append("&isZh=")
- .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
+ htmlUrl.append(notifyFFGGGDJANEvent.getLink()).append(notifyFFGGGDJANEvent.getLink().contains("?") ? "&uid=" : "?uid=").append(userInfo.getId()).append("&token=").append(userInfo.getToken()).append("&isZh=").append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
if (!TextUtils.isEmpty(notifyFFGGGDJANEvent.getH5Type())) {
if (TextUtils.equals(notifyFFGGGDJANEvent.getH5Type(), "1")) {
Bundle bundle = new Bundle();
@@ -1412,9 +1407,7 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyZuoji.setLayoutParams(params);
}
- String text = mTempGifGiftBean.getUserNiceName() + " "
- + mContext.getString(R.string.live_send_buy_zuoji_1)
- + " " + (mTempGifGiftBean.getCarName());
+ String text = mTempGifGiftBean.getUserNiceName() + " " + mContext.getString(R.string.live_send_buy_zuoji_1) + " " + (mTempGifGiftBean.getCarName());
Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont"));
mGifGiftTipBuyZuoji.setText(spanned);
mGifGiftTipBuyZuoji.setSelected(false);
@@ -1453,9 +1446,7 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyLiangName.setLayoutParams(params);
}
- String text = mTempGifGiftBean.getUserNiceName() + " "
- + mContext.getString(R.string.live_send_buy_liang_name_1)
- + " " + mTempGifGiftBean.getLiangName();
+ String text = mTempGifGiftBean.getUserNiceName() + " " + mContext.getString(R.string.live_send_buy_liang_name_1) + " " + mTempGifGiftBean.getLiangName();
Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont"));
mGifGiftTipBuyLiangName.setText(spanned);
mGifGiftTipBuyLiangName.setSelected(false);
diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java
index f30d6121c..4a7e8bb6b 100644
--- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java
+++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java
@@ -474,6 +474,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1);
}
}
+ SWManager.get().setDrPkNumClarity(drPkbeans.size());
if(drPkbeans.size()==1){
mLiveAnchorViewHolder.closeEndPkBt();
}
@@ -518,6 +519,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
dRjoinOtherRoom(u);
//展示结束连麦按钮
mLiveAnchorViewHolder.showEndPkBt();
+ mLiveAnchorViewHolder.setDrpkRoomId(CommonAppConfig.getInstance().getUid());
}
/**
@@ -1172,6 +1174,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
if (removeIndex != -1) {
drPkbeans.remove(removeIndex);
}
+ SWManager.get().setDrPkNumClarity(drPkbeans.size());
setDrPkUserInfoView(drPkbeans);
}
}
diff --git a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java
index 324b8db5a..26ed804b5 100644
--- a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java
+++ b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java
@@ -323,7 +323,6 @@ public class SocketSwClient {
L.eSw("action3 == 2:" + u.getId());
L.eSw("收到对方同意多人PK邀请");
mListener.onLinkDRMicPkApplyOk(u);
- SWManager.get().setDimensions(3);//退出直播间,将分别率设置为 VD_840x480
} else if (action3 == 6) {//开始Pk
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayKsyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayKsyViewHolder.java
index 6480eb369..546f26826 100644
--- a/live/src/main/java/com/yunbao/live/views/LivePlayKsyViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LivePlayKsyViewHolder.java
@@ -298,6 +298,11 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
}
+ @Override
+ public void endLiveMic() {
+
+ }
+
@Override
public ViewGroup getSmallContainer() {
diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java
index 196b6ebc7..c3cf5e695 100644
--- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java
@@ -610,6 +610,11 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
}
+ @Override
+ public void endLiveMic() {
+
+ }
+
@Override
public ViewGroup getSmallContainer() {
return mSmallContainer;
diff --git a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java
index c8211ff9b..0f4e2b5e8 100644
--- a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java
@@ -415,12 +415,14 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}
});
}
-
- private void endLiveMic() {
+ @Override
+ public void endLiveMic() {
L.eSw("endLiveMic");
- swAuManager.setMicAn(false);
- userJoinLinkMic = false;
- MicStatusManager.getInstance().clear();
+ if(swAuManager!=null){
+ swAuManager.setMicAn(false);
+ userJoinLinkMic = false;
+ MicStatusManager.getInstance().clear();
+ }
}
@Override
@@ -882,17 +884,22 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
boolean isShow = false;
+ boolean isShowInvitation = false;
+
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) {
+
if ("UsertoRY".equals(str)) {
//todo 新增dis监听
- if (isShow) {
+ if (isShow||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) {
return;
}
isShow = true;
DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.mic_tag), new DialogUitl.SimpleCallback2() {
@Override
public void onCancelClick() {
+ MicStatusManager.getInstance().setMicData(MicStatusManager.MIC_TYPE_DEFAULT, LiveActivity.mLiveUid);
+ userJoinLinkMic = false;
isShow = false;
}
@@ -904,6 +911,10 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
});
} else if ("inviteMic".equals(str)) {
+ if (isShowInvitation||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) {
+ return;
+ }
+ isShowInvitation = true;
String content = "邀請您進行語音連麥";
String confirm = "接受";
String cancel = "拒絕";
@@ -912,24 +923,28 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
confirm = "accept";
cancel = "cancel";
}
- DialogUitl.Builder builder = new DialogUitl.Builder(mContext).setContent(content).setTitle(mLiveBean.getUserNiceName()).setConfirmString(confirm).setCancelString(cancel).setView(R.layout.dialog_live_mic_invite).setClickCallback(new DialogUitl.SimpleCallback() {
+ DialogUitl.Builder builder = new DialogUitl.Builder(mContext).setContent(content).setTitle(mLiveBean.getUserNiceName()).setConfirmString(confirm).setCancelString(cancel).setView(R.layout.dialog_live_mic_invite).setClickCallback3(new DialogUitl.SimpleCallback3() {
@Override
- public void onConfirmClick(Dialog dialog, String content) {
- String[] permissions;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
- permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO};
- } else {
- permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO};
- }
- LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
- @Override
- public void run() {
- // UsertoRY();
- //将自己设置成给主播,和主播连麦
- L.eSw("将自己设置成给主播,和主播连麦");
- joinLiveMic();
+ public void onConfirmClick(Dialog dialog) {
+ String[] permissions;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO};
+ } else {
+ permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO};
}
- });
+ LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
+ @Override
+ public void run() {
+ L.eSw("将自己设置成给主播,和主播连麦");
+ joinLiveMic();
+ isShowInvitation = false;
+ }
+ });
+ }
+
+ @Override
+ public void onCancel() {
+ isShowInvitation = false;
}
});
builder.build().show();
@@ -948,6 +963,11 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}
}
+ public void endLiveMicUser(){
+ endLiveMic();
+ }
+
+
@Subscribe(threadMode = ThreadMode.MAIN)
public void onOpenDrawer(LiveAudienceEvent event) {
if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO) {
diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayTxViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayTxViewHolder.java
index 5de3bf44a..6097d1038 100644
--- a/live/src/main/java/com/yunbao/live/views/LivePlayTxViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LivePlayTxViewHolder.java
@@ -114,6 +114,11 @@ public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXL
}
+ @Override
+ public void endLiveMic() {
+
+ }
+
@Override
protected int getLayoutId() {
return R.layout.view_live_play_tx;
diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomPlayViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomPlayViewHolder.java
index a06dc20a3..36c8f80b1 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomPlayViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomPlayViewHolder.java
@@ -130,6 +130,8 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
public abstract void claerDrPkInfoView();
+ public abstract void endLiveMic();
+
public interface OnMicCallback {
void onMikUpdate();
diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
index cb714ade5..cf305a878 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -4058,6 +4058,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveGiftAnimPresenter.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent,showB);
}
+ public void cancelAllAnim(){
+ if(mLiveGiftAnimPresenter!=null){
+ mLiveGiftAnimPresenter.releaseServiceNotice();
+ }
+ }
+
+
//全服通知 购买坐骑
public void showBuyZuojiMessage(LiveReceiveGiftBean bean) {
if (mLiveGiftAnimPresenter == null) {
diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
index b8344bcca..79725eff5 100644
--- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
+++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
@@ -957,6 +957,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeCallbacks();
}
+ if(mLivePlayViewHolder!=null){
+ mLivePlayViewHolder.stopPlay2();
+ mLiveRoomViewHolder.cancelAllAnim();
+ }
//断开socket
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
@@ -988,9 +992,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveSwLinkMicPkPresenter.release();
mLiveSwLinkMicPkPresenter = null;
}
- if(mLivePlayViewHolder!=null){
- mLivePlayViewHolder.stopPlay2();
- }
+
if (mLiveEndViewHolder != null) {
removeLiveEnd();
}
@@ -1168,26 +1170,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
- if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) {
- return;
- }
- ToastUtil.show("下麥中,稍等.....");
- RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
-
- /**
- * 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
- * SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
- */
- @Override
- public void onKicked() {
-
- }
-
- @Override
- public void onSuccess() {
- Log.e("ry", "下麦成功");
- // 该用户切换为观众成功,可以以观众身份进行音视频
- //退出多人房间
+ if(isSw){
+ if(mLivePlayViewHolder!=null){
+ mLivePlayViewHolder.endLiveMic();
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
.params("roomid", liveID)
.execute(new HttpCallback() {
@@ -1197,39 +1182,77 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
});
- //退出rtc播放
- RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
- @Override
- public void onSuccess() {
- Log.e("ry", "退出多人房间成功");
+ if (isBackPressed) {
+ MicStatusManager.getInstance().clear();
+ ((LiveAudienceActivity) mContext).closeRoom();
+ } else {
+ EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
+ }
+ }
+ }else{
+ if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) {
+ return;
+ }
+ ToastUtil.show("下麥中,稍等.....");
+ RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
- if (isBackPressed) {
- MicStatusManager.getInstance().clear();
- ((LiveAudienceActivity) mContext).closeRoom();
- } else {
- EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
+ /**
+ * 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
+ * SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
+ */
+ @Override
+ public void onKicked() {
+
+ }
+
+ @Override
+ public void onSuccess() {
+ Log.e("ry", "下麦成功");
+ // 该用户切换为观众成功,可以以观众身份进行音视频
+ //退出多人房间
+ HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
+ .params("roomid", liveID)
+ .execute(new HttpCallback() {
+ @Override
+ public void onSuccess(int code, String msg, String[] info) {
+ Log.e("ry", code + "退出多人");
+
+ }
+ });
+ //退出rtc播放
+ RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
+ @Override
+ public void onSuccess() {
+ Log.e("ry", "退出多人房间成功");
+
+ if (isBackPressed) {
+ MicStatusManager.getInstance().clear();
+ ((LiveAudienceActivity) mContext).closeRoom();
+ } else {
+ EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
+ }
}
- }
- @Override
- public void onFailed(RTCErrorCode errorCode) {
- Log.e("ry", errorCode + "退出多人房间失敗");
+ @Override
+ public void onFailed(RTCErrorCode errorCode) {
+ Log.e("ry", errorCode + "退出多人房间失敗");
- }
- });
+ }
+ });
- }
+ }
- /**
- * 当切换失败且不影响当前角色继续音视频时回调
- * @param errorCode 失败错误码
- */
- @Override
- public void onFailed(RTCErrorCode errorCode) {
- Log.e("ry", "下麦失败" + errorCode);
+ /**
+ * 当切换失败且不影响当前角色继续音视频时回调
+ * @param errorCode 失败错误码
+ */
+ @Override
+ public void onFailed(RTCErrorCode errorCode) {
+ Log.e("ry", "下麦失败" + errorCode);
- }
- });
+ }
+ });
+ }
}
@Override
diff --git a/live/src/main/res/layout/item_anchor_mic_info.xml b/live/src/main/res/layout/item_anchor_mic_info.xml
index 1c254dd47..fade3f7a3 100644
--- a/live/src/main/res/layout/item_anchor_mic_info.xml
+++ b/live/src/main/res/layout/item_anchor_mic_info.xml
@@ -19,7 +19,6 @@
android:gravity="center_vertical"
android:orientation="horizontal">
-
-
@@ -65,8 +64,11 @@
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:maxLines="1"
+ android:ellipsize="end"
android:text="用户名称"
android:textColor="#F6F7FB"
+ tools:textColor="@color/gray1"
android:textSize="14sp" />
@@ -130,7 +132,7 @@
android:id="@+id/mic_btn"
android:layout_width="wrap_content"
android:layout_height="28dp"
- android:layout_marginEnd="36dp"
+ android:layout_marginEnd="10dp"
android:background="@drawable/bg_anchor_mic_info_btn_ok"
android:text="同意"
android:textColor="#FFFFFF"