From b0c5d44d1c4f2a665c293fdf9750bae06d8fb7f5 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Thu, 30 May 2024 13:20:40 +0800 Subject: [PATCH] =?UTF-8?q?fix[=E5=A3=B0=E6=9C=9B=E5=8D=87=E7=BA=A7-?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beautyapi/faceunity/agora/SWManager.java | 26 +++++++++++++++---- .../live/activity/LiveAudienceActivity.java | 3 +++ .../presenter/LiveSwLinkMicPkPresenter.java | 4 +-- .../live/views/LivePlaySwViewHolder.java | 3 ++- .../live/views/LivePushSwViewHolder.java | 22 +++++++++++++--- .../live/views/PortraitLiveManager.java | 2 +- 6 files changed, 47 insertions(+), 13 deletions(-) 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 2b7934d3b..775696051 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 @@ -57,6 +57,12 @@ public class SWManager extends BaseCacheManager { private onRtcEngineListener onRtcEngineListener; private List drPkUserInfo = new ArrayList<>(); + private onDrPkJoinSuccessListener onDrPkJoinSuccessListener; + + public void setOnDrPkJoinSuccessListener(SWManager.onDrPkJoinSuccessListener onDrPkJoinSuccessListener) { + this.onDrPkJoinSuccessListener = onDrPkJoinSuccessListener; + } + public void setOnRtcEngineListener(SWManager.onRtcEngineListener onRtcEngineListener) { this.onRtcEngineListener = onRtcEngineListener; } @@ -322,7 +328,7 @@ public class SWManager extends BaseCacheManager { * @param toUid * @param channelName */ - public void joinChannelDrEx(FrameLayout frameLayout, String strUid, String token, String toUid, String channelName) { + public void joinChannelDrEx(FrameLayout frameLayout, String strUid, String token, String toUid, String channelName,int position) { int tempUid; if (StringUtil.isEmpty(strUid)) { tempUid = 0; @@ -342,6 +348,12 @@ public class SWManager extends BaseCacheManager { RtcConnection rtcConnection = new RtcConnection(); rtcConnection.channelId = channelName; //對方主播的頻道 rtcConnection.localUid = tempUid;//自己的ID + + SurfaceView surfaceView = new SurfaceView(mContext); + surfaceView.setZOrderMediaOverlay(true); + frameLayout.addView(surfaceView); + VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, Integer.parseInt(toUid)); + L.eSw("strUid:" + tempUid + "_token:" + token + "_channelName:" + channelName); // 用内部通知,刷新多人PK的用户信息 mRtcEngine.joinChannelEx(token, rtcConnection, options, new IRtcEngineEventHandler() { @@ -352,10 +364,6 @@ public class SWManager extends BaseCacheManager { mContext.runOnUiThread(new Runnable() { @Override public void run() { - SurfaceView surfaceView = new SurfaceView(mContext); - surfaceView.setZOrderMediaOverlay(true); - frameLayout.addView(surfaceView); - VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, Integer.parseInt(toUid)); mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection); } }); @@ -493,4 +501,12 @@ public class SWManager extends BaseCacheManager { return CommonAppConfig.SWChannelPrefix + liveUid; } } + + public interface onDrPkJoinSuccessListener{ + void joinSuccess1(); + void joinSuccess2(); + void joinSuccess3(); + void joinSuccess4(); + + } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 7493e4e30..0e67649f4 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -350,13 +350,16 @@ public class LiveAudienceActivity extends LiveActivity { if (itemModelList.size() == 0) { return; } + Log.e("直播间接口调用排查", "transformPage 11"); ViewGroup viewGroup = (ViewGroup) page; Log.e(TAG, "position:" + mCurrentItem); if ((position < 0 && viewGroup.getId() != mCurrentItem)) { + Log.e("直播间接口调用排查", "transformPage 22"); // room_container 为视频播放的根布局 id View rootView = viewGroup.findViewById(R.id.drawer_layout); if (rootView != null && rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { ((ViewGroup) (rootView.getParent())).removeView(rootView); + Log.e("直播间接口调用排查", "transformPage 33"); manager.onRemove(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 acba3a23a..f30d6121c 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java @@ -611,7 +611,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); } @@ -1256,7 +1256,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { } } } - }, 2000); + }, 1000); L.eSw("dRjoinOtherRoom:size:" + drPkbeanList.size() + " json " + new Gson().toJson(drPkbeanList)); } 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 844383315..c8211ff9b 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java @@ -638,13 +638,14 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder { mCover.setVisibility(View.VISIBLE); } } - swAuManager.exitChannelAll(); stopPlay2(); } @Override public void stopPlay2() { + swAuManager.exitChannelAll(); drMicUserList = new ArrayList<>(); + } @Override diff --git a/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java index a1d826ecd..08a8dde82 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java @@ -122,6 +122,11 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX } } + public onDrPkJoinSuccessListener onDrPkJoinSuccessListener; + + public void setOnDrPkJoinSuccessListener(LivePushSwViewHolder.onDrPkJoinSuccessListener onDrPkJoinSuccessListener) { + this.onDrPkJoinSuccessListener = onDrPkJoinSuccessListener; + } public LivePushSwViewHolder(Context context, ViewGroup parentView) { super(context, parentView); @@ -362,7 +367,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX } switch (temp) { case 2: - swManager.joinChannelDrEx(dr2_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid)); + swManager.joinChannelDrEx(dr2_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid),temp); swManager.updateMyChannelView(dr1_preview); mBigContainer.removeAllViews(); @@ -371,7 +376,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX break; case 3: drpkUid3 = uid; - swManager.joinChannelDrEx(dr4_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid)); + swManager.joinChannelDrEx(dr4_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid),temp); dr3_preview.setVisibility(View.GONE); dr4_preview.setVisibility(View.VISIBLE); break; @@ -379,9 +384,9 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX dr3_preview.setVisibility(View.VISIBLE); //先退出这个主播的直播间,在进入该直播间,(视图问题暂时這樣處理) swManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), drpkUid3); - swManager.joinChannelDrEx(dr3_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, drpkUid3, SWAuManager.getChannelName(drpkUid3)); + swManager.joinChannelDrEx(dr3_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, drpkUid3, SWAuManager.getChannelName(drpkUid3),temp); - swManager.joinChannelDrEx(dr4_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid)); + swManager.joinChannelDrEx(dr4_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid),temp); break; } dr_pk_view.setVisibility(View.VISIBLE); @@ -654,4 +659,13 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX swManager.exitChannelAll(); } } + + public interface onDrPkJoinSuccessListener{ + void joinSuccess1(); + void joinSuccess2(); + void joinSuccess3(); + void joinSuccess4(); + + } + } 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 dcc465b40..b8344bcca 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -344,9 +344,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } }; - @Override public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk, boolean isSw) { + Log.e("直播间接口调用排查", "onAdd onAdd onAdd onAdd"); isEnterRoom = false; MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表"); openParametersModel = new OpenParametersModel();