From cb376aa83a1b664111928f89b9259a4beb3cea7c Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Tue, 14 May 2024 18:29:28 +0800 Subject: [PATCH] =?UTF-8?q?add[=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 --- .../presenter/LiveRyLinkMicPkPresenter.java | 51 +++---------------- .../live/views/LivePushRyViewHolder.java | 1 - .../live/views/PortraitLiveManager.java | 1 + live/src/main/res/layout/view_live_room.xml | 3 +- 4 files changed, 10 insertions(+), 46 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 059a2f2b2..8357e9d30 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -647,9 +647,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { msg1.param("is_ladders", "https://downs.yaoulive.com/rank_top_box.png"); msg1.create(); System.out.println("PK回执 = " + msg1.toString()); - Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; + 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("g" + bean.getId(), conversationType, messageContent); + io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain( bean.getId(), conversationType, messageContent); RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override @@ -772,6 +772,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { isPK(u); } else { if (mPkWaitCount < 0) { + if(rtcRoom==null){ + return; + } rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() { @Override @@ -1902,6 +1905,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { * 主播与主播PK 所有人收到PK开始的回调 */ public void onLinkMicPkStart(String pkUid, int i) { + L.eSw("onLinkMicPkStart pkUid "+pkUid+" "+i); Log.d("tag", i + "mPkTimeCount2"); mIsPk = true; hideSendPkWait(); @@ -1910,7 +1914,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { mPkUid = pkUid; mApplyUid = null; mApplyStream = null; - + isDRPK=1; if (mLiveLinkMicPkViewHolder == null) { mLiveLinkMicPkViewHolder = new LiveLinkMicPkViewHolder(mContext, mPkContainer); mLiveLinkMicPkViewHolder.addToParent(); @@ -1923,7 +1927,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(pkUid)); mLiveLinkMicPkViewHolder.showTime(); mPkTimeCount = 100; - nextPkTimeCountDown(2); + nextPkTimeCountDown(2);//时间倒计时 if (mIsAnchor) { ((LiveRyAnchorActivity) mContext).setPkBtnVisible(false); mPkTimeCount = PK_TIME_MAX; @@ -2000,45 +2004,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } } }); -// inputStreamList.clear(); - RCRTCMixConfig config = new RCRTCMixConfig(); - RCRTCMixConfig.MediaConfig mediaConfig = new RCRTCMixConfig.MediaConfig(); - config.setMediaConfig(mediaConfig); - //视频输出配置 - RCRTCMixConfig.MediaConfig.VideoConfig videoConfig = new RCRTCMixConfig.MediaConfig.VideoConfig(); - mediaConfig.setVideoConfig(videoConfig); -//大流视频的输出参数 - RCRTCMixConfig.MediaConfig.VideoConfig.VideoLayout normal = new RCRTCMixConfig.MediaConfig.VideoConfig.VideoLayout(); - videoConfig.setVideoLayout(normal); -//推荐宽、高、帧率参数值可以通过默认视频流的配置获取,也可以根据实际需求来自定义设置 -//如不设置宽高值则服务端将使用默认宽高 360 * 640 -//例:发布的视频分辨率为720 * 1280,如果不设置则观众端看到的视频分辨率为 360 * 640, -//所以如果想让观众端看到的视频分辨率和发布视频分辨率一致,则应从发布的视频流中获取分辨率配置并设置到 mediaConfig 中 - RCRTCVideoStreamConfig defaultVideoConfig = RCRTCEngine.getInstance().getDefaultVideoStream().getVideoConfig(); - int fps = defaultVideoConfig.getVideoFps().getFps(); - int width = 720; - int height = 1280; - normal.setWidth(width); //视频宽 - normal.setHeight(height); //视频高 - normal.setFps(fps); //视频帧率 - - //1. 设置自适应合流布局模式 - config.setLayoutMode(RCRTCMixConfig.MixLayoutMode.ADAPTIVE); - //2. 合流画布设置 - if (rcrtcLiveInfo != null) { - rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() { - @Override - public void onSuccess() { - Log.e("ry", "混成功16"); - } - - @Override - public void onFailed(RTCErrorCode errorCode) { - Log.e("ry", "混失败" + errorCode); - - } - }); - } runOnUiThread(new Runnable() { public void run() { diff --git a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java index 4a8b5871c..373a64543 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -648,7 +648,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX } }); - mLiveRyLinkMicPkPresenter.setPkUserInfoView(u); } 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 a6cc00a76..a882f5de1 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -666,6 +666,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe }else{//单人连麦 LivePkMicModel connection_info = data.getEnterRoomInfo().getConnectionInfo(); if(!StringUtil.isEmpty(connection_info.getPkuid())){ + mPkUid = connection_info.getPkuid(); mLivePlayViewHolder.setPkView(connection_info.getPkuid()); } } diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 13d42703d..50469cc42 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -744,9 +744,8 @@ layout="@layout/view_red_packet" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_below="@+id/live_rank_pk" android:layout_marginStart="12dp" - android:layout_marginTop="15dp" + android:layout_marginTop="100dp" android:visibility="gone" />