调整播放器拉升问题5

This commit is contained in:
zlzw 2023-01-09 16:20:54 +08:00
parent 93e2a8af02
commit cc4cc2f746
3 changed files with 19 additions and 6 deletions

View File

@ -34,6 +34,7 @@ public class LiveExoPlayerManager {
private int playBufferIndex = 0;//卡顿计数器
private final Handler handler;
private static double log_buffer_time = 0, log_buffer_max_time;
private String url;
public LiveExoPlayerManager(Context mContext) {
DefaultLoadControl control = new DefaultLoadControl.Builder()
@ -240,6 +241,7 @@ public class LiveExoPlayerManager {
*/
public void startUrl(String url) {
Log.i(TAG, "startUrl: " + url + " > " + mainView.getResizeMode());
this.url = url;
isSwitchUrl = true;
playBufferIndex = 0;
log_buffer_time = System.currentTimeMillis();
@ -259,6 +261,7 @@ public class LiveExoPlayerManager {
*/
public void switchUrl(String url) {
Log.i(TAG, "switchUrl: " + url);
this.url = url;
playBufferIndex = 0;
isSwitchUrl = true;
log_buffer_time = System.currentTimeMillis();
@ -317,4 +320,11 @@ public class LiveExoPlayerManager {
player1.release();
player2.release();
}
public String getUrl() {
if(url==null){
url="";
}
return url;
}
}

View File

@ -314,9 +314,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
Log.i(TAG, "switchStream: " + " url:" + url + " playModel: " + playModel + " landscape: " + landscape + " videoLandscape = " + videoLandscape);
if (playModel != PLAY_MODEL_DEF && !url.contains(videoFps[0] + ".flv")) {
mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL);
if (landscape == VIDEO_VERTICAL) {
if (landscape == VIDEO_VERTICAL && !isPk) {
url = url.replace(".flv", videoRatioVertical[playModel] + videoFps[0] + ".flv");
} else if (landscape == VIDEO_HORIZONTAL) {
} else if (landscape == VIDEO_HORIZONTAL || isPk) {
url = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv");
}
} else if (!url.contains(videoFps[0] + ".flv")) {
@ -341,7 +341,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
@Override
public void switchStreamPk(boolean isPk) {
super.switchStreamPk(isPk);
if (isPk && !srcUrl.contains(videoFps[0] + ".flv") && !tmpPk) {
if (isPk && !tmpPk) {
tmpPk = true;
mPlayer.setViewResizeMode(false);
String url;
@ -404,6 +404,11 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
params1.topMargin = contexts.getResources().getDimensionPixelOffset(R.dimen.live_top);
params1.addRule(RelativeLayout.ALIGN_TOP);
ry_view.requestLayout();
isPk=true;
if (mPlayer.getUrl().contains("848_24.flv") || mPlayer.getUrl().contains("1280_24.flv")) {
tmpPk = false;
switchStreamPk(true);
}
}
/**

View File

@ -1305,9 +1305,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.hotAddVisibility(isPk);
}
if(mLivePlayViewHolder!=null){
mLivePlayViewHolder.switchStreamPk(isPk);
}
}
@Override