From 93e2a8af02248cc7beb65fed106a473a5a7e7c2a Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 9 Jan 2023 15:26:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=92=AD=E6=94=BE=E5=99=A8?= =?UTF-8?q?=E6=8B=89=E5=8D=87=E9=97=AE=E9=A2=984?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/views/LivePlayRyViewHolder.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 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 204664df1..3e00730ff 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -111,6 +111,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { static int vHeight;//视频高 private TextView debugView; private LiveExoPlayerManager mPlayer; + private boolean isPk = false; //0未申请1申请中2连麦中 RCRTCRoom rcrtcRoom; @@ -286,7 +287,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } else if (landscape == VIDEO_HORIZONTAL) { url = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv"); } - } else if(!url.contains(videoFps[0] + ".flv")){ + } else if (!url.contains(videoFps[0] + ".flv")) { mPlayer.setViewResizeMode(false); } Log.e("purl121", url); @@ -318,7 +319,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } else if (landscape == VIDEO_HORIZONTAL) { url = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv"); } - } else if(!url.contains(videoFps[0] + ".flv")){ + } else if (!url.contains(videoFps[0] + ".flv")) { mPlayer.setViewResizeMode(false); } Log.e("purl121", url); @@ -335,13 +336,23 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { purl = url; } + boolean tmpPk = false; + @Override public void switchStreamPk(boolean isPk) { super.switchStreamPk(isPk); - if (isPk && !srcUrl.contains(videoFps[0] + ".flv")) { + if (isPk && !srcUrl.contains(videoFps[0] + ".flv") && !tmpPk) { + tmpPk = true; mPlayer.setViewResizeMode(false); - String url = srcUrl.replace(".flv", videoRatioHorizontal[PLAY_MODEL] + videoFps[0] + ".flv"); - switchStream(url,PLAY_MODEL); + String url; + if (PLAY_MODEL != -1) { + url = srcUrl.replace(".flv", videoRatioHorizontal[PLAY_MODEL] + videoFps[0] + ".flv"); + } else { + url = srcUrl.replace(".flv", videoRatioHorizontal[1] + videoFps[0] + ".flv"); + } + mPlayer.switchUrl(url); + } else if (!isPk) { + tmpPk = false; } } @@ -464,6 +475,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { if (PLAY_MODEL != -1) { url = url.replace(".flv", videoRatioHorizontal[PLAY_MODEL] + videoFps[0] + ".flv"); } + isPk = true; mPlayer.setViewResizeMode(false); mPlayer.switchUrl(url); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); @@ -477,7 +489,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public synchronized void setPkEndview() { Log.i("收收收", landscape + ""); - + isPk = false; + tmpPk = false; if (landscape == 2) { Log.i("收到socket--->", "还原9:16"); String url = srcUrl;