diff --git a/config.gradle b/config.gradle index 808d3435f..a4c1d2a21 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式、 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", // 测试 - serverHost : " https://ceshi.yaoulive.com", +// serverHost : " https://ceshi.yaoulive.com", diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 1cc6f6313..4068cb0a3 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -1099,10 +1099,37 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC, RCRTCParamsType.AudioScenario.MUSIC_CLASSROOM); userinputStreamList1.clear(); userinputStreamList2.clear(); + RCRTCParamsType.RCRTCVideoResolution rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848; + int minRate = 200; + int maxRate = 900; + switch (IMLoginManager.get(mContext).getSelectClarity()) { + case 0: + rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848; + minRate = 200; + maxRate = 900; + break; + case 1: + rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280; + minRate = 250; + maxRate = 2200; + break; + case 2: + rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920; + minRate = 400; + maxRate = 4000; + break; + } // 示例代码使用480x640分辨率演示 RCRTCVideoStreamConfig config = RCRTCVideoStreamConfig .Builder.create() - .setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_640) + //设置分辨率 + .setVideoResolution(rcrtcVideoResolution) + //设置帧率 + .setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_24) + //设置最小码率,480P下推荐200 + .setMinRate(minRate) + //设置最大码率,480P下推荐900 + .setMaxRate(maxRate) .build(); RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(config); // 创建视图渲染视图 @@ -1144,6 +1171,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { Log.e("ry", i + "收到" + stream.getMediaType() + "实打实打算" + rcrtcRoom.getRemoteUsers().get(i).getUserId()); if (stream.getMediaType() == RCRTCMediaType.VIDEO) { if (userinputStreamList1.size() == 0) { + //如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示 RCRTCVideoView remoteView = new RCRTCVideoView(contexts); ((RCRTCVideoInputStream) stream).setStreamType(RCRTCStreamType.NORMAL); @@ -1151,7 +1179,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { ((RCRTCVideoInputStream) stream).setVideoFrameListener(new IRCRTCVideoInputFrameListener() { @Override public void onFrame(RCRTCRemoteVideoFrame videoFrame) { - String debugText = "视频类型:" + videoFrame.getFrameType().name() + "\n" + + String debugText = " 2、安卓主播开播, 安卓用户申请连麦后 ,安卓用户这边底部画面不全 :" + videoFrame.getFrameType().name() + "\n" + "rotation:" + videoFrame.getRotation() + "\n" + "timestampNs:" + videoFrame.getTimestampNs() + "\n" + "分辨率:" + videoFrame.getBuffer().getHeight() + "x" + videoFrame.getBuffer().getWidth() + "\n" + @@ -1165,8 +1193,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { }); //todo 本demo只演示添加1个远端用户的视图 ry_view.removeAllViews(); - remoteView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - remoteView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT); + remoteView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + remoteView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL); ry_view.addView(remoteView); } userinputStreamList1.add(stream);