结构体
AdvancedConfigInfo
public class AdvancedConfigInfo {
private LogUploadServerInfo logUploadServer;
public AdvancedConfigInfo() {
this.logUploadServer = new LogUploadServerInfo();
}
}
定义高级配置信息。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
logUploadServer | LogUploadServerInfo | 日志上传服务器。详见 LogUploadServerInfo 。 |
AgoraServiceConfiguration
public class AgoraServiceConfiguration {
private boolean enableAudioProcessor = true;
private boolean enableAudioDevice = true;
private boolean enableVideo = false;
private Object context = null;
private String appId = null;
private int areaCode = Constants.AreaCode.AREA_CODE_GLOB.getValue();
private int channelProfile = Constants.ChannelProfileType.CHANNEL_PROFILE_LIVE_BROADCASTING.getValue();
private String license = null;
private int audioScenario = Constants.AudioScenarioType.AUDIO_SCENARIO_DEFAULT.getValue();
private LogConfig logConfig = new LogConfig();
private boolean useStringUid = false;
private boolean useExternalEglContext = false;
private boolean domainLimit = false;
public AgoraServiceConfiguration() {
// All default values are set through field initialization
}
}
用于初始化声网服务的配置类。
你可以通过 getter/setter 方法获取或设置这些参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
enableAudioProcessor | boolean | 是否启用音频处理模块。
|
enableAudioDevice | boolean | 是否启用音频设备模块,用于管理音频设备,如录音和播放功能。
注意 在录制场景中,请确保将 |
enableVideo | boolean | 是否启用视频功能。
|
context | Object | 用户上下文。在 Android 平台上,该参数为 Activity 的上下文。 |
appId | String | 你的项目的 。 |
areaCode | int | 支持的区域代码,详见 AreaCode 。默认值为 AREA_CODE_GLOB 。 |
channelProfile | int | 频道场景,详见 ChannelProfileType 。默认值为 CHANNEL_PROFILE_LIVE_BROADCASTING 。 |
license | String | 用于连接频道时进行验证的许可证,根据许可证进行计费。 |
audioScenario | int | 音频场景,详见 AudioScenarioType 。默认值为 AUDIO_SCENARIO_DEFAULT 。 |
logConfig | LogConfig | 用于自定义设置日志路径、日志大小和日志级别的配置。详见 LogConfig 。 |
useStringUid | boolean | 是否启用字符串形式的 UID。
|
useExternalEglContext | boolean | 是否使用当前线程中的 EGL Context 作为 SDK 的根 EGL Context,该 Context 将被所有 EGL 相关模块共享,例如摄像头采集、视频渲染等。
注意 该属性仅适用于 Android 平台。 |
domainLimit | boolean | 是否启用域名限制。
|
EncryptionConfig
public class EncryptionConfig {
private String encryptionKey;
private byte[] encryptionKdfSalt;
public EncryptionConfig() {
this.encryptionMode = Constants.EncryptionMode.AES_128_GCM2;
this.encryptionKey = null;
this.encryptionKdfSalt = new byte[32];
}
}
用于配置声网录制 SDK 的加密参数。
你可以通过 getter/setter 方法获取或设置这些参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
encryptionKey | String | 字符串格式的加密密钥。 注意 如果未设置加密密钥或设置为 |
encryptionKdfSalt | byte[] | 加密密钥的盐值,默认值是由 32 个零组成的数组。 |
LocalAccessPointConfiguration
public class LocalAccessPointConfiguration {
private String[] ipList;
private int ipListSize;
private String[] domainList;
private int domainListSize;
private String verifyDomainName;
private AdvancedConfigInfo advancedConfig;
private boolean disableAut;
public LocalAccessPointConfiguration() {
this.ipList = null;
this.ipListSize = 0;
this.domainList = null;
this.domainListSize = 0;
this.verifyDomainName = null;
this.mode = Constants.LocalProxyMode.ConnectivityFirst;
this.advancedConfig = new AdvancedConfigInfo();
this.disableAut = true;
}
}
用于配置本地接入点参数,可通过 getter/setter 方法获取或设置各参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
ipList | String[] | 本地接入点的 IP 地址列表。 |
ipListSize | int | 本地接入点的 IP 地址数量。 |
domainList | String[] | 本地接入点的域名列表。 |
domainListSize | int | 本地接入点的域名数量。 |
verifyDomainName | String | 安装在特定本地接入点上的证书域名。传入空字符串 "" 表示在该接入点使用 SNI 域名。SNI(Server Name Indication)是 TLS 协议的扩展。 |
advancedConfig | AdvancedConfigInfo | 本地代理连接的高级配置参数。详见 AdvancedConfigInfo 。 |
disableAut | boolean | 是否禁用 vos-aut 模式:
|
LogConfig
public class LogConfig {
private String filePath = null;
private int fileSizeInKB = Constants.DEFAULT_LOG_SIZE_IN_KB;
public LogConfig() {
// All default values are set through field initialization
}
}
用于配置声网录制 SDK 的日志参数。包含日志文件路径和日志文件大小等配置项。你可以通过 getter/setter 方法获取或设置这些参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
filePath | String | 日志文件路径。默认值为 null,表示使用默认日志路径。 |
fileSizeInKB | int | 日志文件大小,单位为 KB。默认值为 1024KB。 |
LogUploadServerInfo
public class LogUploadServerInfo {
private String serverDomain;
private String serverPath;
private int serverPort;
private boolean serverHttps;
public LogUploadServerInfo() {
this.serverDomain = null;
this.serverPath = null;
this.serverPort = 0;
this.serverHttps = true;
}
}
用于配置日志上传服务器信息。你可以通过 getter/setter 方法获取或设置这些参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
serverDomain | String | 日志上传服务器的域名。 |
serverPath | String | 日志上传服务器的路径。 |
serverPort | int | 日志上传服务器的端口。 |
serverHttps | boolean | 是否使用 HTTPS 请求:
|
MediaRecorderConfiguration
public class MediaRecorderConfiguration {
private String storagePath;
private int maxDurationMs;
private int recorderInfoUpdateInterval;
private int width;
private int height;
private int fps;
private int sampleRate;
private int channelNum;
public MediaRecorderConfiguration() {
this.storagePath = null;
this.containerFormat = Constants.MediaRecorderContainerFormat.FORMAT_MP4;
this.streamType = Constants.MediaRecorderStreamType.STREAM_TYPE_BOTH;
this.maxDurationMs = 120000;
this.recorderInfoUpdateInterval = 0;
this.width = 1280;
this.height = 720;
this.fps = 30;
this.sampleRate = 48000;
this.channelNum = 1;
this.videoSourceType = Constants.VideoSourceType.VIDEO_SOURCE_CAMERA_PRIMARY;
}
}
用于配置声网 SDK 中的媒体录制参数。你可以通过 getter/setter 方法获取或设置这些参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
storagePath | String | 录制文件的绝对路径(包含文件扩展名)。例如:Windows:C:/Users/userName/AppData/Local/Agora/process_name/example.mp4;iOS:/App Sandbox/Library/Caches/example.mp4;macOS:/Library/Logs/example.mp4;Android:/storage/emulated/0/Android/data/package_name/files/example.mp4;Linux:result/example.mp4。 注意 确保指定路径存在并且具有写权限。 |
maxDurationMs | int | 录制的最长持续时间,单位为毫秒。默认值为 120000。 |
recorderInfoUpdateInterval | int | 录制信息的更新间隔,单位为毫秒。取值范围为 [1000, 10000]。根据该值,SDK 会触发 onRecorderInfoUpdated 回调报告录制信息更新。 |
width | int | 录制视频的宽度,单位为像素。默认值为 1280。 |
height | int | 录制视频的高度,单位为像素。默认值为 720。 |
fps | int | 录制视频的帧率,单位为帧/秒。默认值为 30。 |
sampleRate | int | 录制音频的采样率,单位为 Hz。默认值为 48000。 |
channelNum | int | 录制音频的声道数。默认值为 1(单声道)。 |
MixerLayoutConfig
public class MixerLayoutConfig {
private int x;
private int y;
private int width;
private int height;
private int zOrder;
private float alpha;
private boolean mirror;
private String imagePath;
private int rotation;
public MixerLayoutConfig() {
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
this.zOrder = 0;
this.alpha = 1.0f;
this.mirror = false;
this.imagePath = null;
this.rotation = 0;
}
}
用于配置声网中混流的视频合流布局。
包含视频合流布局的相关设置,包括位置、大小、图层顺序、透明度、镜像、背景图路径和旋转角度等。你可以通过 getter/setter 方法获取或设置这些参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
x | int | 布局左上角的 x 坐标。 |
y | int | 布局左上角的 y 坐标。 |
width | int | 布局的宽度。 |
height | int | 布局的高度。 |
zOrder | int | 布局的图层顺序。图层值越高,该布局显示在越上层。 |
alpha | float | 布局的透明度,取值范围为 0.0(完全透明)到 1.0(完全不透明)。 |
mirror | boolean | 是否对布局水平镜像:
|
imagePath | String | 布局的背景图文件路径。 |
rotation | int | 布局的旋转角度:
|
RecorderInfo
public class RecorderInfo {
private String fileName;
private int durationMs;
private int fileSize;
}
提供声网 SDK 中录制文件的信息。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
fileName | String | 录制文件的绝对路径。 |
durationMs | int | 录制文件的时长,单位为毫秒。 |
fileSize | int | 录制文件的大小,单位为字节。 |
Rectangle
public class Rectangle {
private int x;
private int y;
private int width;
private int height;
public Rectangle() {
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
}
}
定义 Rectangle
类,可通过 getter/setter 方法获取或设置参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
x | int | 距离左上角的水平偏移量。 |
y | int | 距离左上角的垂直偏移量。 |
width | int | 区域的宽度。 |
height | int | 区域的高度。 |
RemoteAudioStatistics
public class RemoteAudioStatistics {
private int quality;
private int networkTransportDelay;
private int jitterBufferDelay;
private int audioLossRate;
}
获取远端音频流的统计信息。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
quality | int | 音频流的质量。取值范围为 0(未知)到 5(优秀)。 |
networkTransportDelay | int | 网络传输延迟,单位为毫秒。 |
jitterBufferDelay | int | 抖动缓冲延迟,单位为毫秒。 |
audioLossRate | int | 音频丢包率,单位为百分比。 |
RemoteVideoStatistics
public class RemoteVideoStatistics {
private int delay;
private int width;
private int height;
private int receivedBitrate;
private int decoderOutputFrameRate;
}
用于统计声网 SDK 中远端视频流的性能指标。
该类用于提供远端视频流的统计信息,包括延迟、视频尺寸、接收码率和解码器输出帧率等。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
delay | int | 视频延迟,单位为毫秒。 |
width | int | 视频帧的宽度,单位为像素。 |
height | int | 视频帧的高度,单位为像素。 |
receivedBitrate | int | 接收的视频码率,单位为 Kbps。 |
decoderOutputFrameRate | int | 解码器输出的视频帧率,单位为帧每秒(fps)。 |
SpeakVolumeInfo
public class SpeakVolumeInfo {
private String userId;
private int volume;
}
用于表示说话者的音量信息。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
userId | String | 说话者的用户 ID。 |
volume | int | 说话者的音量,取值范围为 0 到 255。 |
UserMixerLayout
public class UserMixerLayout {
private String userId;
private MixerLayoutConfig config;
public UserMixerLayout() {
}
}
表示用户在视频合流布局中的配置。你可以通过 getter/setter 方法获取或设置相应参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
userId | String | 用户的 ID。 |
config | MixerLayoutConfig | 用户的视频合流布局配置。详见 MixerLayoutConfig 。 |
VideoMixingLayout
public class VideoMixingLayout {
private int canvasWidth;
private int canvasHeight;
private int canvasFps;
private long backgroundColor;
private String backgroundImage;
private UserMixerLayout[] userLayoutConfigs;
public VideoMixingLayout() {
this.canvasWidth = 0;
this.canvasHeight = 0;
this.canvasFps = 0;
this.backgroundColor = 0;
this.backgroundImage = null;
this.userLayoutConfigs = null;
}
}
表示视频合流布局配置。用于配置声网 SDK 中的视频合流布局,包括画布尺寸、帧率、背景颜色和用户布局配置。你可以通过 getter/setter 方法获取或设置这些参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
canvasWidth | int | 画布的宽度。 |
canvasHeight | int | 画布的高度。 |
canvasFps | int | 画布的帧率。 |
backgroundColor | long | 画布的背景颜色,以 long 类型表示。 |
backgroundImage | String | 画布的背景图。 |
userLayoutConfigs | UserMixerLayout[] | 用户的视频布局配置。详见 UserMixerLayout 。 |
VideoSubscriptionOptions
public class VideoSubscriptionOptions {
private boolean encodedFrameOnly;
public VideoSubscriptionOptions() {
this.type = Constants.VideoStreamType.VIDEO_STREAM_HIGH;
this.encodedFrameOnly = false;
}
}
用于设置订阅视频流的选项。包含是否仅订阅编码后的视频数据。你可以通过 getter/setter 方法获取或设置该参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
encodedFrameOnly | boolean | 是否仅订阅编码后的视频数据:
|
WatermarkConfig
public class WatermarkConfig {
private int index;
private WatermarkSourceType type;
private WatermarkTimestamp timestampSource;
private WatermarkLitera literaSource;
private String imageUrl;
private WatermarkOptions options;
public WatermarkConfig() {
this.index = 0;
this.type = WatermarkSourceType.PICTURE; // Assuming PICTURE is a valid value in WatermarkSourceType
this.imageUrl = null;
this.timestampSource = null; // Initialize as needed
this.literaSource = null; // Initialize as needed
this.options = null; // Initialize as needed
}
}
用于设置和获取水印参数,可通过 getter/setter 方法访问各项配置。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
index | int | 水印的索引。默认值为 0。 |
type | WatermarkSourceType | 水印的类型,详见 WatermarkSourceType 。 |
timestampSource | WatermarkTimestamp | 水印的时间戳,详见 WatermarkTimestamp 。 |
literaSource | WatermarkLitera | 水印的文字内容,详见 WatermarkLitera 。 |
imageUrl | String | 水印图像文件的 URL。默认值为 null。 |
options | WatermarkOptions | 水印的配置选项,详见 WatermarkOptions 。 |
WatermarkLitera
public class WatermarkLitera {
private String wmLitera;
private String fontFilePath;
private int fontSize;
public WatermarkLitera() {
this.wmLitera = null;
this.fontFilePath = null;
this.fontSize = 10;
}
}
用于设置水印文字内容及其样式。
你可以使用 getter/setter 方法来获取或设置 wmLitera
、fontFilePath
和 fontSize
。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
wmLitera | String | wmLitera 表示水印的文字内容。默认值为 null。 |
fontFilePath | String | fontFilePath 表示水印文字所用字体文件的路径。默认值为 null,表示使用系统字体。 |
fontSize | int | fontSize 表示水印文字的字体大小。默认值为 10。 |
WatermarkOptions
public class WatermarkOptions {
private boolean visibleInPreview;
private Rectangle positionInLandscapeMode;
private Rectangle positionInPortraitMode;
private WatermarkRatio watermarkRatio;
private int zOrder;
public WatermarkOptions() {
this.visibleInPreview = true; // Default value
this.positionInLandscapeMode = new Rectangle(0, 0, 0, 0); // Initialize with default Rectangle
this.positionInPortraitMode = new Rectangle(0, 0, 0, 0); // Initialize with default Rectangle
this.watermarkRatio = new WatermarkRatio(); // Initialize with default WatermarkRatio
this.mode = Constants.WaterMarkFitMode.FIT_MODE_COVER_POSITION; // Default value for mode
this.zOrder = 0; // Default value for zOrder
}
}
用于设置水印参数。
你可以通过 getter/setter 方法获取或设置参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
visibleInPreview | boolean | 水印图片在本地视频预览中是否可见。
|
positionInLandscapeMode | Rectangle | 当水印的适配模式为 FIT_MODE_COVER_POSITION 时,用于设置水印图片在横屏模式下的位置区域。详见 Rectangle 。 |
positionInPortraitMode | Rectangle | 当水印的适配模式为 FIT_MODE_COVER_POSITION 时,用于设置水印图片在竖屏模式下的位置区域。详见 Rectangle 。 |
watermarkRatio | WatermarkRatio | 当水印的适配模式为 FIT_MODE_USE_IMAGE_RATIO 时,用于设置水印的坐标。详见 WatermarkRatio 。 |
zOrder | int | 水印图片的图层顺序。默认值为 0。 |
WatermarkRatio
public class WatermarkRatio {
private float xRatio;
private float yRatio;
private float widthRatio;
public WatermarkRatio() {
this.xRatio = 0.0f;
this.yRatio = 0.0f;
this.widthRatio = 0.0f;
}
}
WatermarkRatio
用于表示水印的相对位置和尺寸。
你可以通过 getter/setter 方法获取或设置参数值。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
xRatio | float | 水印左上角的 x 坐标相对比例。 |
yRatio | float | 水印左上角的 y 坐标相对比例。 |
widthRatio | float | 水印的宽度相对比例。 |
WatermarkTimestamp
public class WatermarkTimestamp {
private int fontSize;
private String fontFilePath;
public WatermarkTimestamp() {
this.fontSize = 10;
this.fontFilePath = null;
}
}
用于定义时间戳的属性。
你可以使用 getter/setter 方法获取或设置参数。
成员参数
参数 | 数据类型 | 描述 |
---|---|---|
fontSize | int | 时间戳的字体大小。默认值为 10。 |
fontFilePath | String | 时间戳字体文件的路径。默认值为 null,表示使用系统字体。 |