From 4a4cc179bfac00b0c389cedaa9f430e533dab697 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 13 Apr 2023 16:26:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=95=E4=BA=BAPK=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E5=90=8E=E6=96=B0=E8=BF=9B=E6=9D=A5=E7=AB=96=E5=B1=8F?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=EF=BC=8C=E7=94=BB=E9=9D=A2=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/views/LivePlayRyViewHolder.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 0267d522b..6399477ad 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -209,12 +209,12 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public synchronized void setLiveBeanLandscape(int landscape) { // landscape=1; - Log.i(TAG, "setLiveBeanLandscape: " + landscape); + Log.i(TAG, "setLiveBeanLandscape: " + landscape + " isPk: " + isPk); this.landscape = landscape; this.videoLandscape = landscape; mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL); if (landscape == 2) { - Log.i("收到socket--->", "还原9:16"); + Log.i(TAG, "还原9:16"); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); params.height = RelativeLayout.LayoutParams.MATCH_PARENT; params.topMargin = 0; @@ -233,6 +233,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { mCover.requestLayout(); } else { + Log.i(TAG, "还原16:9"); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); params.height = vHeight; params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); @@ -258,6 +259,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public void setLiveEnterRoomNewModel(EnterRoomNewModel data) { super.setLiveEnterRoomNewModel(data); isPk = data.getEnterRoomInfo().getIsconnection().equals("1"); + if (isPk) { + setLiveBeanLandscape(1); + } } /** @@ -443,7 +447,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public void setViewUP(int i) { if (mVideoView == null) return; - Log.e("收", "整理" + i); + Log.e("PK状态", "" + i); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); params.height = vHeight; params.topMargin = contexts.getResources().getDimensionPixelOffset(R.dimen.live_top); @@ -478,7 +482,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL); if (landscape == 2) { - Log.i("收到socket--->", "还原9:16"); + Log.i(TAG, "onPrepared:还原9:16 land=" + videoLandscape); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); params.height = height; params.topMargin = 0; @@ -497,6 +501,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { mCover.setLayoutParams(params2); mCover.requestLayout(); } else { + Log.i(TAG, "onPrepared:还原16:9"); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); params.height = height; params.topMargin = 0; @@ -744,7 +749,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { Log.e("ry", "下麦失败" + errorCode); leaveRoom(); } - private void leaveRoom(){ + + private void leaveRoom() { RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() { @Override public void onSuccess() { @@ -925,7 +931,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { UsertoRY(); } }); - }else{ + } else { ToastUtil.show("房间失败" + errorCode); } @@ -941,9 +947,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public void run() { RCRTCEngine.getInstance().enableSpeaker(true); //遍历远端用户发布的资源列表 - Log.i(TAG, "软件资源数量:"+data.getLiveStreams().size()); + Log.i(TAG, "软件资源数量:" + data.getLiveStreams().size()); for (RCRTCInputStream stream : data.getLiveStreams()) { - Log.i(TAG, "资源流 type: "+stream.getMediaType()); + Log.i(TAG, "资源流 type: " + stream.getMediaType()); if (stream.getMediaType() == RCRTCMediaType.VIDEO) { //暂停播放 mPlayer.stop();