fix[声望升级-修复BUG]

This commit is contained in:
Martin 2024-05-28 17:12:52 +08:00
parent 0afee3543e
commit ff8e75768e
10 changed files with 55 additions and 127 deletions

View File

@ -210,7 +210,7 @@ public class AppContext extends CommonAppContext {
if (content.getContent().contains("_method_")) { if (content.getContent().contains("_method_")) {
msg.obj = content.getContent(); msg.obj = content.getContent();
//观众页面 //观众页面
if(CommonAppConfig.getInstance().getConfig().isSw()){ //声网
if (SocketSwClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) { if (SocketSwClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
SocketSwClient.mSocketHandler.sendMessage(msg); SocketSwClient.mSocketHandler.sendMessage(msg);
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知 } else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
@ -227,7 +227,8 @@ public class AppContext extends CommonAppContext {
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketSwClient.mSocketHandler != null) { if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.sendMessage(msg); SocketSwClient.mSocketHandler.sendMessage(msg);
} }
}else{
//融云
if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) { if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
SocketRyClient.mSocketHandler.sendMessage(msg); SocketRyClient.mSocketHandler.sendMessage(msg);
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知 } else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
@ -244,7 +245,6 @@ public class AppContext extends CommonAppContext {
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) { if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.sendMessage(msg); SocketRyClient.mSocketHandler.sendMessage(msg);
} }
}
} else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息 } else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
} }

View File

@ -65,6 +65,12 @@ public abstract class AbsViewHolder implements LifeCycleListener {
} }
} }
public void removeView(){
if (mParentView != null && mContentView != null) {
mParentView.removeView(mContentView);
}
}
public boolean isShow(){ public boolean isShow(){
return mParentView.indexOfChild(mContentView)>-1; return mParentView.indexOfChild(mContentView)>-1;
} }

View File

@ -50,7 +50,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
private String url; private String url;
private LiveBean mLiveBean; private LiveBean mLiveBean;
private int mLiveType; private int mLiveType;
private int mLiveSDK; private boolean mLiveSDK;
private int mLiveTypeVal; private int mLiveTypeVal;
private FloatCallbacks.Builder builder; private FloatCallbacks.Builder builder;
private String TAG = "LiveFloatView"; private String TAG = "LiveFloatView";
@ -86,7 +86,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
cardParams.height = DpUtil.dp2px(224); cardParams.height = DpUtil.dp2px(224);
cardParams.width = DpUtil.dp2px(126); cardParams.width = DpUtil.dp2px(126);
} }
if(mLiveSDK == Constants.LIVE_SDK_SW){ if(mLiveSDK){
L.eSw("mLiveSDK == Constants.LIVE_S2222222222222222"); L.eSw("mLiveSDK == Constants.LIVE_S2222222222222222");
videoFrameLayout = magnetView.findViewById(R.id.videoFrameLayout); videoFrameLayout = magnetView.findViewById(R.id.videoFrameLayout);
swAuManager = SWAuManager.get(); swAuManager = SWAuManager.get();
@ -128,7 +128,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
ViewClicksAntiShake.clicksAntiShake(magnetView.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(magnetView.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
if(mLiveSDK == Constants.LIVE_SDK_SW){ if(mLiveSDK){
SWAuManager.get().exitChannelAll(); SWAuManager.get().exitChannelAll();
}else{ }else{
mPlayer.stopPlay(true); mPlayer.stopPlay(true);
@ -143,7 +143,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
} }
} }
}); });
if(mLiveSDK == Constants.LIVE_SDK_SW){ if(mLiveSDK){
ViewClicksAntiShake.clicksAntiShake(videoFrameLayout, () -> { ViewClicksAntiShake.clicksAntiShake(videoFrameLayout, () -> {
SWAuManager.get().exitChannelAll(); SWAuManager.get().exitChannelAll();
APPEasyFloat.getInstance().dismiss(mContext); APPEasyFloat.getInstance().dismiss(mContext);
@ -166,7 +166,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
@Override @Override
public void dismiss() { public void dismiss() {
if(mLiveSDK == Constants.LIVE_SDK_SW){ if(mLiveSDK){
SWAuManager.get().exitChannelAll(); SWAuManager.get().exitChannelAll();
}else{ }else{
if (mPlayer != null) if (mPlayer != null)
@ -194,7 +194,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
.show(); .show();
} }
public LiveFloatView cacheLiveData(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) { public LiveFloatView cacheLiveData(LiveBean mLiveBean, int mLiveType, boolean mLiveSDK, int mLiveTypeVal) {
this.mLiveBean = mLiveBean; this.mLiveBean = mLiveBean;
this.mLiveType = mLiveType; this.mLiveType = mLiveType;
this.mLiveSDK = mLiveSDK; this.mLiveSDK = mLiveSDK;
@ -247,7 +247,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
cardParams.width = DpUtil.dp2px(126); cardParams.width = DpUtil.dp2px(126);
} }
layout.setLayoutParams(cardParams); layout.setLayoutParams(cardParams);
if(mLiveSDK == Constants.LIVE_SDK_SW){ if(mLiveSDK){
L.eSw("mLiveSDK == Constants.LIVE_SDK_SW mLive1111111"); L.eSw("mLiveSDK == Constants.LIVE_SDK_SW mLive1111111");
swAuManager = SWAuManager.get(); swAuManager = SWAuManager.get();
swAuManager.setAudienceContainer(videoFrameLayout); swAuManager.setAudienceContainer(videoFrameLayout);
@ -289,7 +289,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
ViewClicksAntiShake.clicksAntiShake(view.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(view.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
if(mLiveSDK == Constants.LIVE_SDK_SW){ if(mLiveSDK){
SWAuManager.get().exitChannelAll(); SWAuManager.get().exitChannelAll();
}else{ }else{
mPlayer.stopPlay(true); mPlayer.stopPlay(true);
@ -306,7 +306,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
} }
}); });
ViewClicksAntiShake.clicksAntiShake(view, () -> { ViewClicksAntiShake.clicksAntiShake(view, () -> {
if(mLiveSDK == Constants.LIVE_SDK_SW){ if(mLiveSDK){
SWAuManager.get().exitChannelAll(); SWAuManager.get().exitChannelAll();
}else{ }else{
mPlayer.stopPlay(true); mPlayer.stopPlay(true);
@ -341,7 +341,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
RouteUtil.forwardLiveAudienceActivity(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal,mLiveSDK == Constants.LIVE_SDK_SW); RouteUtil.forwardLiveAudienceActivity(mLiveBean, mLiveType, mLiveSDK ? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_TX, mLiveTypeVal,mLiveSDK);
} else { } else {
//判断是否有直播悬浮窗有直接关闭 //判断是否有直播悬浮窗有直接关闭

View File

@ -450,7 +450,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
LivePushTxViewHolder.mPreView.setLayoutParams(params); LivePushTxViewHolder.mPreView.setLayoutParams(params);
LivePushTxViewHolder.mPreView1.setLayoutParams(params); LivePushTxViewHolder.mPreView1.setLayoutParams(params);
L.eSw("33333333333333333333333333");
final SocketSendBean msg1 = new SocketSendBean() final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK) .param("_method_", Constants.SOCKET_LINK_MIC_PK)
.param("action", 4) .param("action", 4)

View File

@ -55,6 +55,7 @@ import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
@ -793,7 +794,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
livePushRyViewHolder.camera.setLayoutParams(params); livePushRyViewHolder.camera.setLayoutParams(params);
livePushRyViewHolder.mPreView1.setLayoutParams(params); livePushRyViewHolder.mPreView1.setLayoutParams(params);
livePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE); livePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE);
L.eSw("4444444444444444444444444444");
final SocketSendBean msg1 = new SocketSendBean() final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LINK_MIC_PK) .param("_method_", SOCKET_LINK_MIC_PK)
.param("action", 4) .param("action", 4)

View File

@ -162,51 +162,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
return this; return this;
} }
private IRCRTCOtherRoomEventsListener otherRoomEventsListener = new IRCRTCOtherRoomEventsListener() {
@Override
public void onRemoteUserPublishResource(RCRTCOtherRoom room, RCRTCRemoteUser remoteUser, List<RCRTCInputStream> streams) {
}
@Override
public void onRemoteUserMuteAudio(RCRTCOtherRoom room, RCRTCRemoteUser remoteUser, RCRTCInputStream stream, boolean mute) {
}
@Override
public void onRemoteUserMuteVideo(RCRTCOtherRoom room, RCRTCRemoteUser remoteUser, RCRTCInputStream stream, boolean mute) {
}
@Override
public void onRemoteUserUnpublishResource(RCRTCOtherRoom room, RCRTCRemoteUser remoteUser, List<RCRTCInputStream> streams) {
}
@Override
public void onUserJoined(RCRTCOtherRoom room, RCRTCRemoteUser remoteUser) {
}
@Override
public void onUserLeft(RCRTCOtherRoom room, RCRTCRemoteUser remoteUser) {
}
@Override
public void onUserOffline(RCRTCOtherRoom room, RCRTCRemoteUser remoteUser) {
RCRTCEngine.getInstance().leaveOtherRoom(room.getRoomId(), true, new IRCRTCResultCallback() {
@Override
public void onSuccess() {
}
@Override
public void onFailed(RTCErrorCode errorCode) {
}
});
}
@Override
public void onLeaveRoom(RCRTCOtherRoom room, int reasonCode) {
Log.d("RYM_DG", "Other onLeaveRoom: room = " + room.getRoomId());
}
};
public LiveSwLinkMicPkPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, View root) { public LiveSwLinkMicPkPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, View root) {
mContext = context; mContext = context;
mIsAnchor = isAnchor; mIsAnchor = isAnchor;
@ -642,7 +597,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UN_LEAVELIVE)); Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UN_LEAVELIVE));
LiveSwAnchorActivity.isDRPK = 1; LiveSwAnchorActivity.isDRPK = 1;
LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE); LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE);
SocketSwLinkMicPkUtil.linkMicPkAccept(mSocketSwClient, mApplyUid, mApplyUrl, mApplyNmae); //SocketSwLinkMicPkUtil.linkMicPkAccept(mSocketSwClient, mApplyUid, mApplyUrl, mApplyNmae);
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UP_PK_TWO).setObject(mApplyUid)); EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UP_PK_TWO).setObject(mApplyUid));
onLinkMicPkStart(mApplyUid, 2); onLinkMicPkStart(mApplyUid, 2);
} }
@ -670,8 +625,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE); mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
} }
if (mAcceptPk) { if (mAcceptPk) {
isPK(u); LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
/*LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
@ -683,53 +637,36 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
ToastUtil.show(mContext.getString(R.string.pking_over)); ToastUtil.show(mContext.getString(R.string.pking_over));
} }
} }
}}});*/ }}});
} else { } else {
if (mPkWaitCount < 0) { if (mPkWaitCount < 0) {
if(rtcRoom==null){ final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
mIsApplyDialogShow = false; msg1.create();
return; String targetId = u.getId();
} Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() { TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override @Override
public void onFailed(RTCErrorCode errorCode) { public void onAttached(io.rong.imlib.model.Message message) {
} }
@Override @Override
public void onSuccess() { public void onSuccess(io.rong.imlib.model.Message message) {
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
msg1.create();
String targetId = u.getId(); Log.e("ry", "发送成功");
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE; if (SocketSwClient.mSocketHandler != null) {
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); }
}
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override
@Override public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
public void onAttached(io.rong.imlib.model.Message message) { Log.e("ry", "发送失敗" + u.getId());
}
@Override
public void onSuccess(io.rong.imlib.model.Message message) {
Log.e("ry", "发送成功");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
}
}
@Override
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
Log.e("ry", "发送失敗" + u.getId());
}
});
} }
}); });
} }
mApplyUid = null; mApplyUid = null;
mApplyStream = null; mApplyStream = null;

View File

@ -1305,7 +1305,7 @@ public class SocketSwClient {
L.eSw("所有人收到PK开始址的回调"); L.eSw("所有人收到PK开始址的回调");
// RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START); // RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(map.getString("pkuid"))); EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(map.getString("pkuid")));
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("uhead"), map.getString("uname"), map.getString("is_ladders")); mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));
break; break;
case 5://PK时候断开连麦的回调 case 5://PK时候断开连麦的回调
// if (rtcRoom != null) { // if (rtcRoom != null) {

View File

@ -300,6 +300,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
@Override @Override
public void onSuccess(int code, String msgs, String[] info) { public void onSuccess(int code, String msgs, String[] info) {
if (code == 0) { if (code == 0) {
L.eSw("555555555555555555555555555555555555");
final SocketSendBean msg1 = new SocketSendBean() final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK) .param("_method_", Constants.SOCKET_LINK_MIC_PK)
.param("action", 4) .param("action", 4)

View File

@ -344,24 +344,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
}; };
boolean isChangeSdk = false;
@Override @Override
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk, boolean isSw1) { public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk, boolean isSw) {
if(isSw==isSw1){
L.eSw("直播SDK 没有改变了 "+isSw1);
isChangeSdk = false;
}else{
L.eSw("直播SDK 改变了 "+isSw1);
isChangeSdk = true;
}
isSw = isSw1;
isEnterRoom = false; isEnterRoom = false;
MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表"); MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表");
openParametersModel = new OpenParametersModel(); openParametersModel = new OpenParametersModel();
/*if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.UpPkTwo(); mLiveRoomViewHolder.UpPkTwo();
}*/ }
mContext.runOnUiThread(new Runnable() { mContext.runOnUiThread(new Runnable() {
@Override @Override
@ -396,28 +387,23 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
frameAnimation.start(); frameAnimation.start();
liveHandler.removeCallbacks(loadRunnableGone); liveHandler.removeCallbacks(loadRunnableGone);
liveHandler.removeCallbacks(loadTimeoutRunnableGone); liveHandler.removeCallbacks(loadTimeoutRunnableGone);
if (mLivePlayViewHolder == null) {
if (mLivePlayViewHolder == null|| isChangeSdk) {
if (isSw) { if (isSw) {
mLivePlayViewHolder = new LivePlaySwViewHolder(mContext, playContainer, 1); mLivePlayViewHolder = new LivePlaySwViewHolder(mContext, playContainer, 1);
} else { } else {
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1); mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
} }
mLivePlayViewHolder.initSwEngine(mLiveBean.getUid());
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager(),isSw); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager(),isSw);
mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer); mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView()); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null); mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
if (isSw) { if (isSw) {
mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
} else { } else {
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
} }
mLivePlayViewHolder.initSwEngine(mLiveBean.getUid());
mLivePlayViewHolder.removeFromParent();
mLivePlayViewHolder.addToParent(); mLivePlayViewHolder.addToParent();
mLivePlayViewHolder.subscribeActivityLifeCycle(); mLivePlayViewHolder.subscribeActivityLifeCycle();
mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() { mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() {
@ -427,15 +413,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
liveHandler.removeCallbacks(loadTimeoutRunnableGone); liveHandler.removeCallbacks(loadTimeoutRunnableGone);
} }
}); });
mLiveRoomViewHolder.removeFromParent();
mLiveRoomViewHolder.addToParent();
mLiveRoomViewHolder.subscribeActivityLifeCycle(); mLiveRoomViewHolder.subscribeActivityLifeCycle();
mLiveAudienceViewHolder.removeFromParent();
mLiveAudienceViewHolder.addToParent(); mLiveAudienceViewHolder.addToParent();
mLiveRoomViewHolder.addToParent();
mLiveAudienceViewHolder.subscribeActivityLifeCycle(); mLiveAudienceViewHolder.subscribeActivityLifeCycle();
} else { } else {
mLivePlayViewHolder.initSwEngine(mLiveBean.getUid()); mLivePlayViewHolder.initSwEngine(liveID);
mLivePlayViewHolder.setLiveBeanLandscape(1); mLivePlayViewHolder.setLiveBeanLandscape(1);
mLiveLinkMicPresenter.setLiveSdk(mLiveSDK); mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK); mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
@ -1030,7 +1013,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter = null; mLiveRyLinkMicPkPresenter = null;
if (PermissionUtils.checkPermission(mContext) && !kick) { if (PermissionUtils.checkPermission(mContext) && !kick) {
LiveFloatView.getInstance() LiveFloatView.getInstance()
.cacheLiveData(mLiveBean, mLiveType, isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY, mLiveTypeVal) .cacheLiveData(mLiveBean, mLiveType, isSw, mLiveTypeVal)
.builderSystemFloat(mContext, mLiveBean.getPull()); .builderSystemFloat(mContext, mLiveBean.getPull());
mContext.finish(); mContext.finish();
} else { } else {
@ -1038,7 +1021,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
EventBus.getDefault() EventBus.getDefault()
.post(new LiveFloatEvent() .post(new LiveFloatEvent()
.setmLiveBean(mLiveBean) .setmLiveBean(mLiveBean)
.setmLiveSDK(isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY) .setmLiveSDK(isSw?2:mLiveSDK)
.setmLiveType(mLiveType) .setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal)); .setmLiveTypeVal(mLiveTypeVal));
} }
@ -1077,7 +1060,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
boolean floatPermission = PermissionUtils.checkPermission(mContext); boolean floatPermission = PermissionUtils.checkPermission(mContext);
if (mLiveBean != null && !isQuitF && !isForeground && floatPermission) { if (mLiveBean != null && !isQuitF && !isForeground && floatPermission) {
LiveFloatView.getInstance() LiveFloatView.getInstance()
.cacheLiveData(mLiveBean, mLiveType, isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY, mLiveTypeVal) .cacheLiveData(mLiveBean, mLiveType, isSw, mLiveTypeVal)
.builderSystemFloat(mContext, mLiveBean.getPull()); .builderSystemFloat(mContext, mLiveBean.getPull());
mContext.finish(); mContext.finish();
} }

View File

@ -1510,7 +1510,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveFloatEvent(LiveFloatEvent event) { public void onLiveFloatEvent(LiveFloatEvent event) {
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) { if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) {
new Handler().post(() -> LiveFloatView.getInstance().cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal()).builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class)); new Handler().post(() -> LiveFloatView.getInstance().cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK() ==Constants.LIVE_SDK_SW, event.getmLiveTypeVal()).builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
} }
} }