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

View File

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

View File

@ -450,7 +450,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
LivePushTxViewHolder.mPreView.setLayoutParams(params);
LivePushTxViewHolder.mPreView1.setLayoutParams(params);
L.eSw("33333333333333333333333333");
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
.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.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
@ -793,7 +794,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
livePushRyViewHolder.camera.setLayoutParams(params);
livePushRyViewHolder.mPreView1.setLayoutParams(params);
livePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE);
L.eSw("4444444444444444444444444444");
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LINK_MIC_PK)
.param("action", 4)

View File

@ -162,51 +162,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
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) {
mContext = context;
mIsAnchor = isAnchor;
@ -642,7 +597,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UN_LEAVELIVE));
LiveSwAnchorActivity.isDRPK = 1;
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));
onLinkMicPkStart(mApplyUid, 2);
}
@ -670,8 +625,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
}
if (mAcceptPk) {
isPK(u);
/*LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
@ -683,53 +637,36 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
ToastUtil.show(mContext.getString(R.string.pking_over));
}
}
}}});*/
}}});
} else {
if (mPkWaitCount < 0) {
if(rtcRoom==null){
mIsApplyDialogShow = false;
return;
}
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
msg1.create();
String targetId = u.getId();
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
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
public void onFailed(RTCErrorCode errorCode) {
public void onAttached(io.rong.imlib.model.Message message) {
}
@Override
public void onSuccess() {
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
msg1.create();
public void onSuccess(io.rong.imlib.model.Message message) {
String targetId = u.getId();
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
Log.e("ry", "发送成功");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
}
}
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(io.rong.imlib.model.Message message) {
}
@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());
}
});
@Override
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
Log.e("ry", "发送失敗" + u.getId());
}
});
}
mApplyUid = null;
mApplyStream = null;

View File

@ -1305,7 +1305,7 @@ public class SocketSwClient {
L.eSw("所有人收到PK开始址的回调");
// RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
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;
case 5://PK时候断开连麦的回调
// if (rtcRoom != null) {

View File

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

View File

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

View File

@ -1510,7 +1510,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveFloatEvent(LiveFloatEvent event) {
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));
}
}