From a39005b1a9c6017121f28184f5779dd46247d999 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 30 Oct 2023 15:12:00 +0800 Subject: [PATCH] =?UTF-8?q?=202=E3=80=81=E5=AE=89=E5=8D=93=E4=B8=BB?= =?UTF-8?q?=E6=92=AD=E5=BC=80=E6=92=AD=EF=BC=8C=20=E5=AE=89=E5=8D=93?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=94=B3=E8=AF=B7=E8=BF=9E=E9=BA=A6=E5=90=8E?= =?UTF-8?q?=20=EF=BC=8C=E5=AE=89=E5=8D=93=E7=94=A8=E6=88=B7=E8=BF=99?= =?UTF-8?q?=E8=BE=B9=E5=BA=95=E9=83=A8=E7=94=BB=E9=9D=A2=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 4 +-- .../live/views/LivePlayRyViewHolder.java | 36 ++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) 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);