调整播放器3
This commit is contained in:
parent
e2761049e5
commit
2e6efc69e8
@ -39,11 +39,11 @@ public class LiveExoPlayerManager {
|
||||
public LiveExoPlayerManager(Context mContext) {
|
||||
DefaultLoadControl control = new DefaultLoadControl.Builder()
|
||||
.setPrioritizeTimeOverSizeThresholds(false)
|
||||
.setBackBuffer(15_000, true)
|
||||
.setBufferDurationsMs(150,
|
||||
5_000,
|
||||
50,
|
||||
100)
|
||||
.setBackBuffer(120_000, true)
|
||||
.setBufferDurationsMs(500,
|
||||
60_000,
|
||||
150,
|
||||
200)
|
||||
.build();
|
||||
player1 = new ExoPlayer.Builder(mContext).setLoadControl(control).build();
|
||||
player2 = new ExoPlayer.Builder(mContext).setLoadControl(control).build();
|
||||
|
@ -244,7 +244,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
@Override
|
||||
public void setLiveEnterRoomNewModel(EnterRoomNewModel data) {
|
||||
super.setLiveEnterRoomNewModel(data);
|
||||
isPk=data.getEnterRoomInfo().getIsconnection().equals("1");
|
||||
isPk = data.getEnterRoomInfo().getIsconnection().equals("1");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -282,9 +282,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
Log.i(TAG, "play" + " 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) {
|
||||
waitNextUrl = url.replace(".flv", videoRatioVertical[playModel] + videoFps[0] + ".flv");
|
||||
} else if (landscape == VIDEO_HORIZONTAL) {
|
||||
} else if (landscape == VIDEO_HORIZONTAL || isPk) {
|
||||
waitNextUrl = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv");
|
||||
}
|
||||
} else if (!url.contains(videoFps[0] + ".flv")) {
|
||||
@ -311,7 +311,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
public void switchStream(String url, int playModel) {
|
||||
srcUrl = url;
|
||||
PLAY_MODEL = playModel;
|
||||
Log.i(TAG, "switchStream: " + " url:" + url + " playModel: " + playModel + " landscape: " + landscape + " videoLandscape = " + videoLandscape + " ispk = " + isPk+" bean = "+roomModel.getEnterRoomInfo().getIsconnection());
|
||||
Log.i(TAG, "switchStream: " + " url:" + url + " playModel: " + playModel + " landscape: " + landscape + " videoLandscape = " + videoLandscape + " ispk = " + isPk + " bean = " + roomModel.getEnterRoomInfo().getIsconnection());
|
||||
if (playModel != PLAY_MODEL_DEF && !url.contains(videoFps[0] + ".flv")) {
|
||||
mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL);
|
||||
if (landscape == VIDEO_VERTICAL && !isPk) {
|
||||
@ -342,7 +342,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
@Override
|
||||
public void switchStreamPk(boolean isPk) {
|
||||
super.switchStreamPk(isPk);
|
||||
if (isPk && !tmpPk) {
|
||||
Log.i(TAG, "switchStreamPk: isPk1" + isPk + " tmp = " + !tmpPk + " isPk2" + this.isPk);
|
||||
if (isPk && !tmpPk || this.isPk) {
|
||||
tmpPk = true;
|
||||
mPlayer.setViewResizeMode(false);
|
||||
String url;
|
||||
@ -502,24 +503,15 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
Log.i("收收收", landscape + "");
|
||||
isPk = false;
|
||||
tmpPk = false;
|
||||
switchStreamPk(false);
|
||||
if (landscape == 2) {
|
||||
Log.i("收到socket--->", "还原9:16");
|
||||
String url = srcUrl;
|
||||
switchStreamPk(false);
|
||||
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||
params.topMargin = 0;
|
||||
mVideoView.requestLayout();
|
||||
|
||||
} else {
|
||||
String url = srcUrl;
|
||||
if (PLAY_MODEL != -1) {
|
||||
url = url.replace(".flv", videoRatioHorizontal[PLAY_MODEL] + videoFps[0] + ".flv");
|
||||
}
|
||||
mPlayer.setViewResizeMode(false);
|
||||
mPlayer.switchUrl(url);
|
||||
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
@ -1166,7 +1158,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
Player.Listener.super.onIsPlayingChanged(isPlaying);
|
||||
if (isPlaying) {
|
||||
hideCover();
|
||||
Log.i(TAG, "onIsPlayingChanged: 开始播放");
|
||||
Log.i(TAG, "onIsPlayingChanged: 开始播放 | waitNextUrl = "+waitNextUrl);
|
||||
OkDownload.getInstance().startAll();
|
||||
if (loadingListener != null) {
|
||||
loadingListener.onPlayer();
|
||||
|
Loading…
Reference in New Issue
Block a user