diff --git a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java index a4946015f..0b09da2f2 100644 --- a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java +++ b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java @@ -91,7 +91,7 @@ public class SWManager extends BaseCacheManager { uid = Integer.parseInt(strUid); } try { - if(mRtcEngine==null){ + if (mRtcEngine == null) { // 创建 RtcEngineConfig 对象,并进行配置 RtcEngineConfig config = new RtcEngineConfig(); config.mContext = mContext; @@ -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 { } - - - /** * 设置镜像模式 */ @@ -344,7 +316,7 @@ public class SWManager extends BaseCacheManager { @Override public void onVideoSizeChanged(Constants.VideoSourceType source, int uid, int width, int height, int rotation) { super.onVideoSizeChanged(source, uid, width, height, rotation); - L.eSw("uid:"+uid+"\nwidth:"+width+"\nheight:"+height); + L.eSw("uid:" + uid + "\nwidth:" + width + "\nheight:" + height); } }); } @@ -358,7 +330,7 @@ public class SWManager extends BaseCacheManager { * @param toUid * @param channelName */ - public void joinChannelDrEx(FrameLayout frameLayout, String strUid, String token, String toUid, String channelName,int position) { + public void joinChannelDrEx(FrameLayout frameLayout, String strUid, String token, String toUid, String channelName, int position) { int tempUid; if (StringUtil.isEmpty(strUid)) { tempUid = 0; @@ -532,10 +504,13 @@ public class SWManager extends BaseCacheManager { } } - public interface onDrPkJoinSuccessListener{ + public interface onDrPkJoinSuccessListener { void joinSuccess1(); + void joinSuccess2(); + void joinSuccess3(); + void joinSuccess4(); } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java index f7be14ecb..625805231 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java @@ -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++) { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java index c1512f98d..16f6c2eb1 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java @@ -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"); diff --git a/live/src/main/java/com/yunbao/live/views/LiveNewReadySwViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveNewReadySwViewHolder.java index ff5bd9ede..44a9a4d5d 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveNewReadySwViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveNewReadySwViewHolder.java @@ -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());