修复单人PK结算后新进来竖屏直播间,画面异常问题

This commit is contained in:
zlzw 2023-04-13 16:26:57 +08:00
parent db8dc2a781
commit 4a4cc179bf

View File

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