fix[声望升级-修复BUG]

This commit is contained in:
Martin 2024-05-30 13:20:40 +08:00
parent d9b1149832
commit b0c5d44d1c
6 changed files with 47 additions and 13 deletions

View File

@ -57,6 +57,12 @@ public class SWManager extends BaseCacheManager {
private onRtcEngineListener onRtcEngineListener; private onRtcEngineListener onRtcEngineListener;
private List<String> drPkUserInfo = new ArrayList<>(); private List<String> drPkUserInfo = new ArrayList<>();
private onDrPkJoinSuccessListener onDrPkJoinSuccessListener;
public void setOnDrPkJoinSuccessListener(SWManager.onDrPkJoinSuccessListener onDrPkJoinSuccessListener) {
this.onDrPkJoinSuccessListener = onDrPkJoinSuccessListener;
}
public void setOnRtcEngineListener(SWManager.onRtcEngineListener onRtcEngineListener) { public void setOnRtcEngineListener(SWManager.onRtcEngineListener onRtcEngineListener) {
this.onRtcEngineListener = onRtcEngineListener; this.onRtcEngineListener = onRtcEngineListener;
} }
@ -322,7 +328,7 @@ public class SWManager extends BaseCacheManager {
* @param toUid * @param toUid
* @param channelName * @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; int tempUid;
if (StringUtil.isEmpty(strUid)) { if (StringUtil.isEmpty(strUid)) {
tempUid = 0; tempUid = 0;
@ -342,6 +348,12 @@ public class SWManager extends BaseCacheManager {
RtcConnection rtcConnection = new RtcConnection(); RtcConnection rtcConnection = new RtcConnection();
rtcConnection.channelId = channelName; //對方主播的頻道 rtcConnection.channelId = channelName; //對方主播的頻道
rtcConnection.localUid = tempUid;//自己的ID 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); L.eSw("strUid:" + tempUid + "_token:" + token + "_channelName:" + channelName);
// 用内部通知刷新多人PK的用户信息 // 用内部通知刷新多人PK的用户信息
mRtcEngine.joinChannelEx(token, rtcConnection, options, new IRtcEngineEventHandler() { mRtcEngine.joinChannelEx(token, rtcConnection, options, new IRtcEngineEventHandler() {
@ -352,10 +364,6 @@ public class SWManager extends BaseCacheManager {
mContext.runOnUiThread(new Runnable() { mContext.runOnUiThread(new Runnable() {
@Override @Override
public void run() { 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); mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
} }
}); });
@ -493,4 +501,12 @@ public class SWManager extends BaseCacheManager {
return CommonAppConfig.SWChannelPrefix + liveUid; return CommonAppConfig.SWChannelPrefix + liveUid;
} }
} }
public interface onDrPkJoinSuccessListener{
void joinSuccess1();
void joinSuccess2();
void joinSuccess3();
void joinSuccess4();
}
} }

View File

@ -350,13 +350,16 @@ public class LiveAudienceActivity extends LiveActivity {
if (itemModelList.size() == 0) { if (itemModelList.size() == 0) {
return; return;
} }
Log.e("直播间接口调用排查", "transformPage 11");
ViewGroup viewGroup = (ViewGroup) page; ViewGroup viewGroup = (ViewGroup) page;
Log.e(TAG, "position:" + mCurrentItem); Log.e(TAG, "position:" + mCurrentItem);
if ((position < 0 && viewGroup.getId() != mCurrentItem)) { if ((position < 0 && viewGroup.getId() != mCurrentItem)) {
Log.e("直播间接口调用排查", "transformPage 22");
// room_container 为视频播放的根布局 id // room_container 为视频播放的根布局 id
View rootView = viewGroup.findViewById(R.id.drawer_layout); View rootView = viewGroup.findViewById(R.id.drawer_layout);
if (rootView != null && rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { if (rootView != null && rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
((ViewGroup) (rootView.getParent())).removeView(rootView); ((ViewGroup) (rootView.getParent())).removeView(rootView);
Log.e("直播间接口调用排查", "transformPage 33");
manager.onRemove(false); manager.onRemove(false);
} }
} }

View File

@ -611,7 +611,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);
} }
@ -1256,7 +1256,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
} }
} }
} }
}, 2000); }, 1000);
L.eSw("dRjoinOtherRoom:size:" + drPkbeanList.size() + " json " + new Gson().toJson(drPkbeanList)); L.eSw("dRjoinOtherRoom:size:" + drPkbeanList.size() + " json " + new Gson().toJson(drPkbeanList));
} }

View File

@ -638,13 +638,14 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
mCover.setVisibility(View.VISIBLE); mCover.setVisibility(View.VISIBLE);
} }
} }
swAuManager.exitChannelAll();
stopPlay2(); stopPlay2();
} }
@Override @Override
public void stopPlay2() { public void stopPlay2() {
swAuManager.exitChannelAll();
drMicUserList = new ArrayList<>(); drMicUserList = new ArrayList<>();
} }
@Override @Override

View File

@ -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) { public LivePushSwViewHolder(Context context, ViewGroup parentView) {
super(context, parentView); super(context, parentView);
@ -362,7 +367,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
} }
switch (temp) { switch (temp) {
case 2: 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); swManager.updateMyChannelView(dr1_preview);
mBigContainer.removeAllViews(); mBigContainer.removeAllViews();
@ -371,7 +376,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
break; break;
case 3: case 3:
drpkUid3 = uid; 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); dr3_preview.setVisibility(View.GONE);
dr4_preview.setVisibility(View.VISIBLE); dr4_preview.setVisibility(View.VISIBLE);
break; break;
@ -379,9 +384,9 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
dr3_preview.setVisibility(View.VISIBLE); dr3_preview.setVisibility(View.VISIBLE);
//先退出这个主播的直播间在进入该直播间视图问题暂时這樣處理 //先退出这个主播的直播间在进入该直播间视图问题暂时這樣處理
swManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), drpkUid3); 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; break;
} }
dr_pk_view.setVisibility(View.VISIBLE); dr_pk_view.setVisibility(View.VISIBLE);
@ -654,4 +659,13 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
swManager.exitChannelAll(); swManager.exitChannelAll();
} }
} }
public interface onDrPkJoinSuccessListener{
void joinSuccess1();
void joinSuccess2();
void joinSuccess3();
void joinSuccess4();
}
} }

View File

@ -344,9 +344,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
}; };
@Override @Override
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk, boolean isSw) { public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk, boolean isSw) {
Log.e("直播间接口调用排查", "onAdd onAdd onAdd onAdd");
isEnterRoom = false; isEnterRoom = false;
MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表"); MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表");
openParametersModel = new OpenParametersModel(); openParametersModel = new OpenParametersModel();