fix[声望升级-设置竖屏]

This commit is contained in:
Martin 2024-06-01 15:21:23 +08:00
parent 6132338c6c
commit efce2ad93c
4 changed files with 23 additions and 48 deletions

View File

@ -111,21 +111,20 @@ public class SWManager extends BaseCacheManager {
mRtcEngine.startPreview();
cfg = new VideoEncoderConfiguration();
//设置默认分辨率
switch (IMLoginManager.get(mContext).getSelectClarity()) {
case 0:
cfg.dimensions = VideoEncoderConfiguration.VD_840x480;
break;
case 1:
cfg.dimensions = VideoEncoderConfiguration.VD_1280x720;
break;
case 2:
cfg.dimensions = VideoEncoderConfiguration.VD_1920x1080;
break;
}
VideoEncoderConfiguration.VideoDimensions videoDimensions = new VideoEncoderConfiguration.VideoDimensions();
videoDimensions.width = 720;
videoDimensions.height = 1280;
cfg.dimensions = videoDimensions;
cfg.frameRate = 20;
cfg.bitrate = 0;
cfg.mirrorMode = VideoEncoderConfiguration.MIRROR_MODE_TYPE.MIRROR_MODE_ENABLED; //镜像
//镜像
cfg.mirrorMode = VideoEncoderConfiguration.MIRROR_MODE_TYPE.MIRROR_MODE_ENABLED;
//设置竖屏
cfg.orientationMode = VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT;
mRtcEngine.setVideoEncoderConfiguration(cfg);
// 创建一个 SurfaceView 对象并将其作为 FrameLayout 的子对象
@ -158,33 +157,9 @@ public class SWManager extends BaseCacheManager {
* 2人连麦PK:360x640
* 3人连麦PK:左侧主播 360x640,右侧两个主播 360x320
* 4人连麦PK:360X320
*
* @param selectClarity
*/
public void setDimensions(int selectClarity) {
if (cfg != null && mRtcEngine != null) {
switch (selectClarity) {
case 0:
cfg.dimensions = VideoEncoderConfiguration.VD_840x480;
L.eSw("VideoEncoderConfiguration.VD_840x480");
break;
case 1:
cfg.dimensions = VideoEncoderConfiguration.VD_1280x720;
L.eSw("VideoEncoderConfiguration.VD_1280x720");
break;
case 2:
cfg.dimensions = VideoEncoderConfiguration.VD_1920x1080;
L.eSw("VideoEncoderConfiguration.VD_1920x1080");
break;
case 3:
cfg.dimensions = VideoEncoderConfiguration.VD_320x240;
L.eSw("VideoEncoderConfiguration.VD_320x240");
break;
}
mRtcEngine.setVideoEncoderConfiguration(cfg);
}
}
public void setDrPkNumClarity(int selectClarity) {
if (cfg != null && mRtcEngine != null) {
VideoEncoderConfiguration.VideoDimensions videoDimensions = new VideoEncoderConfiguration.VideoDimensions();
@ -211,9 +186,6 @@ public class SWManager extends BaseCacheManager {
}
/**
* 设置镜像模式
*/
@ -534,8 +506,11 @@ public class SWManager extends BaseCacheManager {
public interface onDrPkJoinSuccessListener {
void joinSuccess1();
void joinSuccess2();
void joinSuccess3();
void joinSuccess4();
}

View File

@ -1010,7 +1010,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
}
JSONObject obj = JSONObject.parseObject(info[0]);
drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class);
SWManager.get().setDimensions(3);//加入成功后将分别率设置为 VD_320x240
SWManager.get().setDrPkNumClarity(3);//加入成功后将分别率设置为 VD_320x240
//将自己从多人pk列表里剔除
int removeIndex = -1;
for (int i = 0; i < drPkbeans.size(); i++) {

View File

@ -345,7 +345,7 @@ public class SocketSwClient {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview();
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_END_VIEW));
}
SWManager.get().setDimensions(0);//退出直播间将分别率设置为 VD_840x480
SWManager.get().setDrPkNumClarity(1);//退出直播间将分别率设置为 VD_840x480
//創建了多人房間
} else if (action3 == 3) {
L.eSw("創建了多人房間action3 == 3");

View File

@ -230,7 +230,7 @@ public class LiveNewReadySwViewHolder extends AbsViewHolder implements View.OnCl
// Log.e("网速和内存", "内存:" + + " 网速:" + DeviceUtils.getNetSpeed(mContext));
IMLoginManager.get(mContext).setSelectClarity(selectClarity);
setSelectClarity(IMLoginManager.get(mContext).getSelectClarity());
//setSelectClarity(IMLoginManager.get(mContext).getSelectClarity());
ViewClicksAntiShake
.clicksAntiShake(
findViewById(R.id.btn_live_clarity), () -> {
@ -324,7 +324,7 @@ public class LiveNewReadySwViewHolder extends AbsViewHolder implements View.OnCl
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.setSelectClarity(selectClarity);
}
SWManager.get().setDimensions(selectClarity);
//SWManager.get().setDimensions(selectClarity);
Log.e("切换分辨率", "时间戳" + System.currentTimeMillis());
//重新发布一下流
Bus.get().post(new LivePushRyEvent());