调整播放器拉升问题5
This commit is contained in:
parent
cc4cc2f746
commit
7070f5c1b4
@ -10,9 +10,9 @@ ext {
|
||||
manifestPlaceholders = [
|
||||
//正式
|
||||
|
||||
serverHost : "https://napi.yaoulive.com",
|
||||
// serverHost : "https://napi.yaoulive.com",
|
||||
//
|
||||
// serverHost : "https://ceshi.yaoulive.com",
|
||||
serverHost : "https://ceshi.yaoulive.com",
|
||||
|
||||
//腾讯地图
|
||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||
|
@ -45,8 +45,8 @@ public class LiveExoPlayerManager {
|
||||
50,
|
||||
100)
|
||||
.build();
|
||||
player1 = new ExoPlayer.Builder(mContext).build();
|
||||
player2 = new ExoPlayer.Builder(mContext).build();
|
||||
player1 = new ExoPlayer.Builder(mContext).setLoadControl(control).build();
|
||||
player2 = new ExoPlayer.Builder(mContext).setLoadControl(control).build();
|
||||
player1.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
|
||||
player2.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
|
||||
|
||||
|
@ -337,6 +337,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
|
||||
boolean tmpPk = false;
|
||||
String waitNextUrl = null;
|
||||
|
||||
@Override
|
||||
public void switchStreamPk(boolean isPk) {
|
||||
@ -350,9 +351,18 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
} else {
|
||||
url = srcUrl.replace(".flv", videoRatioHorizontal[1] + videoFps[0] + ".flv");
|
||||
}
|
||||
mPlayer.switchUrl(url);
|
||||
waitNextUrl = url;
|
||||
mPlayer.switchUrl(srcUrl);
|
||||
} else if (!isPk) {
|
||||
tmpPk = false;
|
||||
if (landscape == VIDEO_VERTICAL && PLAY_MODEL != -1) {
|
||||
waitNextUrl = srcUrl.replace(".flv", videoRatioVertical[PLAY_MODEL] + videoFps[0] + ".flv");
|
||||
} else if (landscape == VIDEO_HORIZONTAL && PLAY_MODEL != -1) {
|
||||
waitNextUrl = srcUrl.replace(".flv", videoRatioHorizontal[PLAY_MODEL] + videoFps[0] + ".flv");
|
||||
} else {
|
||||
waitNextUrl = null;
|
||||
}
|
||||
mPlayer.switchUrl(srcUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,12 +487,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
public void setPkview() {
|
||||
Log.i("收到socket--->", "变成16:9");
|
||||
String url = srcUrl;
|
||||
if (PLAY_MODEL != -1) {
|
||||
url = url.replace(".flv", videoRatioHorizontal[PLAY_MODEL] + videoFps[0] + ".flv");
|
||||
}
|
||||
isPk = true;
|
||||
mPlayer.setViewResizeMode(false);
|
||||
mPlayer.switchUrl(url);
|
||||
switchStreamPk(true);
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
@ -499,11 +504,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
if (landscape == 2) {
|
||||
Log.i("收到socket--->", "还原9:16");
|
||||
String url = srcUrl;
|
||||
if (PLAY_MODEL != -1) {
|
||||
url = url.replace(".flv", videoRatioVertical[PLAY_MODEL] + videoFps[0] + ".flv");
|
||||
}
|
||||
mPlayer.setViewResizeMode(true);
|
||||
mPlayer.switchUrl(url);
|
||||
switchStreamPk(false);
|
||||
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||
@ -1139,7 +1140,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||
Player.Listener.super.onVideoSizeChanged(videoSize);
|
||||
Log.i(TAG, "onVideoSizeChanged: width = " + videoSize.width + " height = " + videoSize.height);
|
||||
// ToastUtil.show("分辨率: 宽 = " + videoSize.width + " 高 = " + videoSize.height);
|
||||
ToastUtil.show("分辨率: 宽 = " + videoSize.width + " 高 = " + videoSize.height);
|
||||
if (videoSize.height > videoSize.width) {
|
||||
videoLandscape = VIDEO_VERTICAL;
|
||||
} else {
|
||||
@ -1169,6 +1170,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
if (loadingListener != null) {
|
||||
loadingListener.onPlayer();
|
||||
}
|
||||
if (waitNextUrl != null) {
|
||||
mPlayer.switchUrl(waitNextUrl);
|
||||
waitNextUrl = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user