Merge remote-tracking branch 'origin/声网升级' into 声网升级

This commit is contained in:
zlzw 2024-05-31 18:01:36 +08:00
commit 9621d8a6d8
13 changed files with 205 additions and 111 deletions

View File

@ -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);
}
}
/** /**
* 设置镜像模式 * 设置镜像模式
*/ */

View File

@ -123,6 +123,7 @@ import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.base.RCRTCRect; import cn.rongcloud.rtc.base.RCRTCRect;
import cn.rongcloud.rtc.base.RTCErrorCode; import cn.rongcloud.rtc.base.RTCErrorCode;
import io.agora.beautyapi.faceunity.agora.SWManager;
import io.rong.imlib.IRongCallback; import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
@ -1656,6 +1657,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.endDRGif(); mLiveRoomViewHolder.endDRGif();
} }
} }
SWManager.get().setDrPkNumClarity(1);
// if (mLiveRoomViewHolder != null) { // if (mLiveRoomViewHolder != null) {
// mLiveRoomViewHolder.hotAddVisibility(false); // mLiveRoomViewHolder.hotAddVisibility(false);
// } // }

View File

@ -374,18 +374,13 @@ public class LiveGiftAnimPresenter {
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP).setmLiveUid(mLiveUid).setmStream(mStream).setmWishGiftId(blindBox.getEvent().getBlindBoxId() + "").setIsContactGift(true));
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
.setmLiveUid(mLiveUid)
.setmStream(mStream)
.setmWishGiftId(blindBox.getEvent().getBlindBoxId() + "")
.setIsContactGift(true));
} }
}, 1000); }, 1000);
} else { } else {
if (mIvLook.getTag()!=null&&mIvLook.getTag()instanceof LiveReceiveGiftBean){ if (mIvLook.getTag() != null && mIvLook.getTag() instanceof LiveReceiveGiftBean) {
changeLiveRoom((LiveReceiveGiftBean) mIvLook.getTag()); changeLiveRoom((LiveReceiveGiftBean) mIvLook.getTag());
}else { } else {
changeLiveRoom(); changeLiveRoom();
} }
@ -436,6 +431,7 @@ public class LiveGiftAnimPresenter {
} }
}); });
} }
private void changeLiveRoom(LiveReceiveGiftBean mTempGifGiftBean) { private void changeLiveRoom(LiveReceiveGiftBean mTempGifGiftBean) {
if (mTempGifGiftBean != null) { if (mTempGifGiftBean != null) {
String uid = mTempGifGiftBean.getUid(); String uid = mTempGifGiftBean.getUid();
@ -459,7 +455,7 @@ public class LiveGiftAnimPresenter {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override @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) { if (liveBean == null) {
return; return;
} }
@ -503,7 +499,7 @@ public class LiveGiftAnimPresenter {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override @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) { if (liveBean == null) {
return; 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() { private void setGitTipAnimatorBuyZuoji() {
mDp500 = DpUtil.dp2px(500); mDp500 = DpUtil.dp2px(500);
mGifGiftTipShowAnimatorBuyZuoji = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyZuoji, "translationX", mDp500, 0); mGifGiftTipShowAnimatorBuyZuoji = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyZuoji, "translationX", mDp500, 0);
@ -1003,8 +1009,7 @@ public class LiveGiftAnimPresenter {
} }
} }
} else { } else {
if ((bean.getGifUrl().contains("svga") || bean.getGifUrl().contains("gif")) && if ((bean.getGifUrl().contains("svga") || bean.getGifUrl().contains("gif")) && IMLoginManager.get(mContext).isGiftEffect()) {
IMLoginManager.get(mContext).isGiftEffect()) {
//同一直播间玩家自己送礼物也能看到全服通知 //同一直播间玩家自己送礼物也能看到全服通知
//同一直播间其他玩家也能看到全服通知 //同一直播间其他玩家也能看到全服通知
@ -1159,6 +1164,7 @@ public class LiveGiftAnimPresenter {
mRoomNum = event.getLiveuid(); mRoomNum = event.getLiveuid();
if (mShowAllServer) { if (mShowAllServer) {
L.eSw("mGifAll != null");
if (mGifAll != null) { if (mGifAll != null) {
LiveReceiveGiftBean bean = new LiveReceiveGiftBean(); LiveReceiveGiftBean bean = new LiveReceiveGiftBean();
bean.setSendtype(91); bean.setSendtype(91);
@ -1167,6 +1173,7 @@ public class LiveGiftAnimPresenter {
mGifAll.offer(bean); mGifAll.offer(bean);
} }
} else { } else {
L.eSw("mGifAll != nullnullnullnullnullnull");
notifyFFGGGDJANEvent = event; notifyFFGGGDJANEvent = event;
mShowAllServer = true; mShowAllServer = true;
index4Guard = getFirstIndexOfValue(heightOffsetArr, 0); index4Guard = getFirstIndexOfValue(heightOffsetArr, 0);
@ -1264,23 +1271,17 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyGuardNew.setVisibility(View.VISIBLE); mGifGiftTipGroupBuyGuardNew.setVisibility(View.VISIBLE);
switch (event.getGuardType()) { switch (event.getGuardType()) {
case "1": case "1":
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_star_zh : R.mipmap.background_all_server_notify_star_en);
R.mipmap.background_all_server_notify_star_zh :
R.mipmap.background_all_server_notify_star_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#072A93")); mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#072A93"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_star_guard_onlookers); mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_star_guard_onlookers);
break; break;
case "2": case "2":
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_king_zh : R.mipmap.background_all_server_notify_king_en);
R.mipmap.background_all_server_notify_king_zh :
R.mipmap.background_all_server_notify_king_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#BF0B0A")); mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#BF0B0A"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_king_guard_onlookers); mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_king_guard_onlookers);
break; break;
case "3": case "3":
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_god_zh : R.mipmap.background_all_server_notify_sgod_en);
R.mipmap.background_all_server_notify_god_zh :
R.mipmap.background_all_server_notify_sgod_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#41057E")); mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#41057E"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_god_guard_onlookers); mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_god_guard_onlookers);
break; break;
@ -1333,13 +1334,7 @@ public class LiveGiftAnimPresenter {
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
if (!TextUtils.isEmpty(notifyFFGGGDJANEvent.getLink())) { if (!TextUtils.isEmpty(notifyFFGGGDJANEvent.getLink())) {
StringBuffer htmlUrl = new StringBuffer(); StringBuffer htmlUrl = new StringBuffer();
htmlUrl.append(notifyFFGGGDJANEvent.getLink()) 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"));
.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.isEmpty(notifyFFGGGDJANEvent.getH5Type())) {
if (TextUtils.equals(notifyFFGGGDJANEvent.getH5Type(), "1")) { if (TextUtils.equals(notifyFFGGGDJANEvent.getH5Type(), "1")) {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -1412,9 +1407,7 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyZuoji.setLayoutParams(params); mGifGiftTipGroupBuyZuoji.setLayoutParams(params);
} }
String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>" String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>" + mContext.getString(R.string.live_send_buy_zuoji_1) + "</myfont> " + (mTempGifGiftBean.getCarName());
+ mContext.getString(R.string.live_send_buy_zuoji_1)
+ "</myfont> " + (mTempGifGiftBean.getCarName());
Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont")); Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont"));
mGifGiftTipBuyZuoji.setText(spanned); mGifGiftTipBuyZuoji.setText(spanned);
mGifGiftTipBuyZuoji.setSelected(false); mGifGiftTipBuyZuoji.setSelected(false);
@ -1453,9 +1446,7 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyLiangName.setLayoutParams(params); mGifGiftTipGroupBuyLiangName.setLayoutParams(params);
} }
String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>" String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>" + mContext.getString(R.string.live_send_buy_liang_name_1) + "</myfont> " + mTempGifGiftBean.getLiangName();
+ mContext.getString(R.string.live_send_buy_liang_name_1)
+ "</myfont> " + mTempGifGiftBean.getLiangName();
Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont")); Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont"));
mGifGiftTipBuyLiangName.setText(spanned); mGifGiftTipBuyLiangName.setText(spanned);
mGifGiftTipBuyLiangName.setSelected(false); mGifGiftTipBuyLiangName.setSelected(false);

View File

@ -474,6 +474,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1); livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1);
} }
} }
SWManager.get().setDrPkNumClarity(drPkbeans.size());
if(drPkbeans.size()==1){ if(drPkbeans.size()==1){
mLiveAnchorViewHolder.closeEndPkBt(); mLiveAnchorViewHolder.closeEndPkBt();
} }
@ -518,6 +519,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
dRjoinOtherRoom(u); dRjoinOtherRoom(u);
//展示结束连麦按钮 //展示结束连麦按钮
mLiveAnchorViewHolder.showEndPkBt(); mLiveAnchorViewHolder.showEndPkBt();
mLiveAnchorViewHolder.setDrpkRoomId(CommonAppConfig.getInstance().getUid());
} }
/** /**
@ -1172,6 +1174,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
if (removeIndex != -1) { if (removeIndex != -1) {
drPkbeans.remove(removeIndex); drPkbeans.remove(removeIndex);
} }
SWManager.get().setDrPkNumClarity(drPkbeans.size());
setDrPkUserInfoView(drPkbeans); setDrPkUserInfoView(drPkbeans);
} }
} }

View File

@ -323,7 +323,6 @@ public class SocketSwClient {
L.eSw("action3 == 2:" + u.getId()); L.eSw("action3 == 2:" + u.getId());
L.eSw("收到对方同意多人PK邀请"); L.eSw("收到对方同意多人PK邀请");
mListener.onLinkDRMicPkApplyOk(u); mListener.onLinkDRMicPkApplyOk(u);
SWManager.get().setDimensions(3);//退出直播间将分别率设置为 VD_840x480
} else if (action3 == 6) {//开始Pk } else if (action3 == 6) {//开始Pk
if (LiveRoomViewHolder.mHandler != null) { if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);

View File

@ -298,6 +298,11 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
} }
@Override
public void endLiveMic() {
}
@Override @Override
public ViewGroup getSmallContainer() { public ViewGroup getSmallContainer() {

View File

@ -610,6 +610,11 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
} }
@Override
public void endLiveMic() {
}
@Override @Override
public ViewGroup getSmallContainer() { public ViewGroup getSmallContainer() {
return mSmallContainer; return mSmallContainer;

View File

@ -415,12 +415,14 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
} }
}); });
} }
@Override
private void endLiveMic() { public void endLiveMic() {
L.eSw("endLiveMic"); L.eSw("endLiveMic");
swAuManager.setMicAn(false); if(swAuManager!=null){
userJoinLinkMic = false; swAuManager.setMicAn(false);
MicStatusManager.getInstance().clear(); userJoinLinkMic = false;
MicStatusManager.getInstance().clear();
}
} }
@Override @Override
@ -882,17 +884,22 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
boolean isShow = false; boolean isShow = false;
boolean isShowInvitation = false;
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) { public void onUpdata(String str) {
if ("UsertoRY".equals(str)) { if ("UsertoRY".equals(str)) {
//todo 新增dis监听 //todo 新增dis监听
if (isShow) { if (isShow||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) {
return; return;
} }
isShow = true; isShow = true;
DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.mic_tag), new DialogUitl.SimpleCallback2() { DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.mic_tag), new DialogUitl.SimpleCallback2() {
@Override @Override
public void onCancelClick() { public void onCancelClick() {
MicStatusManager.getInstance().setMicData(MicStatusManager.MIC_TYPE_DEFAULT, LiveActivity.mLiveUid);
userJoinLinkMic = false;
isShow = false; isShow = false;
} }
@ -904,6 +911,10 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}); });
} else if ("inviteMic".equals(str)) { } else if ("inviteMic".equals(str)) {
if (isShowInvitation||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) {
return;
}
isShowInvitation = true;
String content = "邀請您進行語音連麥"; String content = "邀請您進行語音連麥";
String confirm = "接受"; String confirm = "接受";
String cancel = "拒絕"; String cancel = "拒絕";
@ -912,24 +923,28 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
confirm = "accept"; confirm = "accept";
cancel = "cancel"; 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 @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog) {
String[] permissions; String[] permissions;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO}; permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO};
} else { } else {
permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO}; 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();
} }
}); LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
@Override
public void run() {
L.eSw("将自己设置成给主播,和主播连麦");
joinLiveMic();
isShowInvitation = false;
}
});
}
@Override
public void onCancel() {
isShowInvitation = false;
} }
}); });
builder.build().show(); builder.build().show();
@ -948,6 +963,11 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
} }
} }
public void endLiveMicUser(){
endLiveMic();
}
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onOpenDrawer(LiveAudienceEvent event) { public void onOpenDrawer(LiveAudienceEvent event) {
if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO) { if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO) {

View File

@ -114,6 +114,11 @@ public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXL
} }
@Override
public void endLiveMic() {
}
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.view_live_play_tx; return R.layout.view_live_play_tx;

View File

@ -130,6 +130,8 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
public abstract void claerDrPkInfoView(); public abstract void claerDrPkInfoView();
public abstract void endLiveMic();
public interface OnMicCallback { public interface OnMicCallback {
void onMikUpdate(); void onMikUpdate();

View File

@ -4058,6 +4058,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveGiftAnimPresenter.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent,showB); mLiveGiftAnimPresenter.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent,showB);
} }
public void cancelAllAnim(){
if(mLiveGiftAnimPresenter!=null){
mLiveGiftAnimPresenter.releaseServiceNotice();
}
}
//全服通知 购买坐骑 //全服通知 购买坐骑
public void showBuyZuojiMessage(LiveReceiveGiftBean bean) { public void showBuyZuojiMessage(LiveReceiveGiftBean bean) {
if (mLiveGiftAnimPresenter == null) { if (mLiveGiftAnimPresenter == null) {

View File

@ -957,6 +957,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveAudienceViewHolder != null) { if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeCallbacks(); mLiveAudienceViewHolder.removeCallbacks();
} }
if(mLivePlayViewHolder!=null){
mLivePlayViewHolder.stopPlay2();
mLiveRoomViewHolder.cancelAllAnim();
}
//断开socket //断开socket
if (mSocketRyClient != null) { if (mSocketRyClient != null) {
mSocketRyClient.disConnect(); mSocketRyClient.disConnect();
@ -988,9 +992,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveSwLinkMicPkPresenter.release(); mLiveSwLinkMicPkPresenter.release();
mLiveSwLinkMicPkPresenter = null; mLiveSwLinkMicPkPresenter = null;
} }
if(mLivePlayViewHolder!=null){
mLivePlayViewHolder.stopPlay2();
}
if (mLiveEndViewHolder != null) { if (mLiveEndViewHolder != null) {
removeLiveEnd(); removeLiveEnd();
} }
@ -1168,26 +1170,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() { DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() {
@Override @Override
public void onConfirmClick(Dialog dialog) { public void onConfirmClick(Dialog dialog) {
if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) { if(isSw){
return; if(mLivePlayViewHolder!=null){
} mLivePlayViewHolder.endLiveMic();
ToastUtil.show("下麥中,稍等.....");
RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
/**
* 当切换失败且SDK处于无法回退状态时回调该角色已经无法使用当前角色继续进行音视频
* SDK内部会退出房间并清理所有资源该用户只能重新加入房间才能继续音视频
*/
@Override
public void onKicked() {
}
@Override
public void onSuccess() {
Log.e("ry", "下麦成功");
// 该用户切换为观众成功可以以观众身份进行音视频
//退出多人房间
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm") HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
.params("roomid", liveID) .params("roomid", liveID)
.execute(new HttpCallback() { .execute(new HttpCallback() {
@ -1197,39 +1182,77 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
}); });
//退出rtc播放 if (isBackPressed) {
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() { MicStatusManager.getInstance().clear();
@Override ((LiveAudienceActivity) mContext).closeRoom();
public void onSuccess() { } else {
Log.e("ry", "退出多人房间成功"); 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(); * 当切换失败且SDK处于无法回退状态时回调该角色已经无法使用当前角色继续进行音视频
((LiveAudienceActivity) mContext).closeRoom(); * SDK内部会退出房间并清理所有资源该用户只能重新加入房间才能继续音视频
} else { */
EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal)); @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 @Override
public void onFailed(RTCErrorCode errorCode) { public void onFailed(RTCErrorCode errorCode) {
Log.e("ry", errorCode + "退出多人房间失敗"); Log.e("ry", errorCode + "退出多人房间失敗");
} }
}); });
} }
/** /**
* 当切换失败且不影响当前角色继续音视频时回调 * 当切换失败且不影响当前角色继续音视频时回调
* @param errorCode 失败错误码 * @param errorCode 失败错误码
*/ */
@Override @Override
public void onFailed(RTCErrorCode errorCode) { public void onFailed(RTCErrorCode errorCode) {
Log.e("ry", "下麦失败" + errorCode); Log.e("ry", "下麦失败" + errorCode);
} }
}); });
}
} }
@Override @Override

View File

@ -19,7 +19,6 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<RelativeLayout <RelativeLayout
android:layout_width="65dp" android:layout_width="65dp"
android:layout_height="65dp" android:layout_height="65dp"
@ -46,11 +45,11 @@
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:autoPlay="true" /> app:autoPlay="true" />
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:orientation="vertical"> android:orientation="vertical">
@ -65,8 +64,11 @@
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:text="用户名称" android:text="用户名称"
android:textColor="#F6F7FB" android:textColor="#F6F7FB"
tools:textColor="@color/gray1"
android:textSize="14sp" /> android:textSize="14sp" />
<ImageView <ImageView
@ -100,7 +102,7 @@
</LinearLayout> </LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="120dp"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -130,7 +132,7 @@
android:id="@+id/mic_btn" android:id="@+id/mic_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="28dp" android:layout_height="28dp"
android:layout_marginEnd="36dp" android:layout_marginEnd="10dp"
android:background="@drawable/bg_anchor_mic_info_btn_ok" android:background="@drawable/bg_anchor_mic_info_btn_ok"
android:text="同意" android:text="同意"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"