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;