2、安卓主播开播, 安卓用户申请连麦后 ,安卓用户这边底部画面不全

This commit is contained in:
18401019693 2023-10-30 15:12:00 +08:00
parent ec1197e5da
commit a39005b1a9
2 changed files with 34 additions and 6 deletions

View File

@ -9,9 +9,9 @@ ext {
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
// serverHost : "https://napi.yaoulive.com", serverHost : "https://napi.yaoulive.com",
// //
serverHost : " https://ceshi.yaoulive.com", // serverHost : " https://ceshi.yaoulive.com",

View File

@ -1099,10 +1099,37 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC, RCRTCParamsType.AudioScenario.MUSIC_CLASSROOM); RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC, RCRTCParamsType.AudioScenario.MUSIC_CLASSROOM);
userinputStreamList1.clear(); userinputStreamList1.clear();
userinputStreamList2.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分辨率演示 // 示例代码使用480x640分辨率演示
RCRTCVideoStreamConfig config = RCRTCVideoStreamConfig RCRTCVideoStreamConfig config = RCRTCVideoStreamConfig
.Builder.create() .Builder.create()
.setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_640) //设置分辨率
.setVideoResolution(rcrtcVideoResolution)
//设置帧率
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_24)
//设置最小码率480P下推荐200
.setMinRate(minRate)
//设置最大码率480P下推荐900
.setMaxRate(maxRate)
.build(); .build();
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(config); 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()); Log.e("ry", i + "收到" + stream.getMediaType() + "实打实打算" + rcrtcRoom.getRemoteUsers().get(i).getUserId());
if (stream.getMediaType() == RCRTCMediaType.VIDEO) { if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
if (userinputStreamList1.size() == 0) { if (userinputStreamList1.size() == 0) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
((RCRTCVideoInputStream) stream).setStreamType(RCRTCStreamType.NORMAL); ((RCRTCVideoInputStream) stream).setStreamType(RCRTCStreamType.NORMAL);
@ -1151,7 +1179,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
((RCRTCVideoInputStream) stream).setVideoFrameListener(new IRCRTCVideoInputFrameListener() { ((RCRTCVideoInputStream) stream).setVideoFrameListener(new IRCRTCVideoInputFrameListener() {
@Override @Override
public void onFrame(RCRTCRemoteVideoFrame videoFrame) { public void onFrame(RCRTCRemoteVideoFrame videoFrame) {
String debugText = "视频类型:" + videoFrame.getFrameType().name() + "\n" + String debugText = " 2、安卓主播开播 安卓用户申请连麦后 ,安卓用户这边底部画面不全 :" + videoFrame.getFrameType().name() + "\n" +
"rotation:" + videoFrame.getRotation() + "\n" + "rotation:" + videoFrame.getRotation() + "\n" +
"timestampNs:" + videoFrame.getTimestampNs() + "\n" + "timestampNs:" + videoFrame.getTimestampNs() + "\n" +
"分辨率:" + videoFrame.getBuffer().getHeight() + "x" + videoFrame.getBuffer().getWidth() + "\n" + "分辨率:" + videoFrame.getBuffer().getHeight() + "x" + videoFrame.getBuffer().getWidth() + "\n" +
@ -1165,8 +1193,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
}); });
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
ry_view.removeAllViews(); ry_view.removeAllViews();
remoteView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); remoteView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
remoteView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT); remoteView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
ry_view.addView(remoteView); ry_view.addView(remoteView);
} }
userinputStreamList1.add(stream); userinputStreamList1.add(stream);