修复单人PK结算后新进来竖屏直播间,画面异常问题
This commit is contained in:
parent
db8dc2a781
commit
4a4cc179bf
@ -209,12 +209,12 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void setLiveBeanLandscape(int landscape) {
|
public synchronized void setLiveBeanLandscape(int landscape) {
|
||||||
// landscape=1;
|
// landscape=1;
|
||||||
Log.i(TAG, "setLiveBeanLandscape: " + landscape);
|
Log.i(TAG, "setLiveBeanLandscape: " + landscape + " isPk: " + isPk);
|
||||||
this.landscape = landscape;
|
this.landscape = landscape;
|
||||||
this.videoLandscape = landscape;
|
this.videoLandscape = landscape;
|
||||||
mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL);
|
mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL);
|
||||||
if (landscape == 2) {
|
if (landscape == 2) {
|
||||||
Log.i("收到socket--->", "还原9:16");
|
Log.i(TAG, "还原9:16");
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||||
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||||
params.topMargin = 0;
|
params.topMargin = 0;
|
||||||
@ -233,6 +233,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
mCover.requestLayout();
|
mCover.requestLayout();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Log.i(TAG, "还原16:9");
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||||
params.height = vHeight;
|
params.height = vHeight;
|
||||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||||
@ -258,6 +259,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
public void setLiveEnterRoomNewModel(EnterRoomNewModel data) {
|
public void setLiveEnterRoomNewModel(EnterRoomNewModel data) {
|
||||||
super.setLiveEnterRoomNewModel(data);
|
super.setLiveEnterRoomNewModel(data);
|
||||||
isPk = data.getEnterRoomInfo().getIsconnection().equals("1");
|
isPk = data.getEnterRoomInfo().getIsconnection().equals("1");
|
||||||
|
if (isPk) {
|
||||||
|
setLiveBeanLandscape(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -443,7 +447,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
@Override
|
@Override
|
||||||
public void setViewUP(int i) {
|
public void setViewUP(int i) {
|
||||||
if (mVideoView == null) return;
|
if (mVideoView == null) return;
|
||||||
Log.e("收", "整理" + i);
|
Log.e("PK状态", "" + i);
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||||
params.height = vHeight;
|
params.height = vHeight;
|
||||||
params.topMargin = contexts.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
params.topMargin = contexts.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||||
@ -478,7 +482,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
}
|
}
|
||||||
mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL);
|
mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL);
|
||||||
if (landscape == 2) {
|
if (landscape == 2) {
|
||||||
Log.i("收到socket--->", "还原9:16");
|
Log.i(TAG, "onPrepared:还原9:16 land=" + videoLandscape);
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||||
params.height = height;
|
params.height = height;
|
||||||
params.topMargin = 0;
|
params.topMargin = 0;
|
||||||
@ -497,6 +501,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
mCover.setLayoutParams(params2);
|
mCover.setLayoutParams(params2);
|
||||||
mCover.requestLayout();
|
mCover.requestLayout();
|
||||||
} else {
|
} else {
|
||||||
|
Log.i(TAG, "onPrepared:还原16:9");
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||||
params.height = height;
|
params.height = height;
|
||||||
params.topMargin = 0;
|
params.topMargin = 0;
|
||||||
@ -744,7 +749,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
Log.e("ry", "下麦失败" + errorCode);
|
Log.e("ry", "下麦失败" + errorCode);
|
||||||
leaveRoom();
|
leaveRoom();
|
||||||
}
|
}
|
||||||
private void leaveRoom(){
|
|
||||||
|
private void leaveRoom() {
|
||||||
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
|
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@ -925,7 +931,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
UsertoRY();
|
UsertoRY();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
ToastUtil.show("房间失败" + errorCode);
|
ToastUtil.show("房间失败" + errorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,9 +947,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
public void run() {
|
public void run() {
|
||||||
RCRTCEngine.getInstance().enableSpeaker(true);
|
RCRTCEngine.getInstance().enableSpeaker(true);
|
||||||
//遍历远端用户发布的资源列表
|
//遍历远端用户发布的资源列表
|
||||||
Log.i(TAG, "软件资源数量:"+data.getLiveStreams().size());
|
Log.i(TAG, "软件资源数量:" + data.getLiveStreams().size());
|
||||||
for (RCRTCInputStream stream : data.getLiveStreams()) {
|
for (RCRTCInputStream stream : data.getLiveStreams()) {
|
||||||
Log.i(TAG, "资源流 type: "+stream.getMediaType());
|
Log.i(TAG, "资源流 type: " + stream.getMediaType());
|
||||||
if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
|
if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
|
||||||
//暂停播放
|
//暂停播放
|
||||||
mPlayer.stop();
|
mPlayer.stop();
|
||||||
|
Loading…
Reference in New Issue
Block a user