typedef NS_ENUM(NSUInteger, ByteRTCRenderMode)
视频渲染模式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCRenderModeHidden | 1 | 视窗填满优先。 视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 |
| ByteRTCRenderModeFit | 2 | 视频帧内容全部显示优先。 视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。 |
| ByteRTCRenderModeAdaptive | 3 | 视频帧自适应视窗 视频帧非等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的高或宽会被拉伸。 |
typedef NS_ENUM(NSUInteger, ByteRTCUserOfflineReason)
用户离开房间的原因。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCUserOfflineReasonQuit | 0 | 远端用户调用 leaveRoom 方法主动退出房间。 |
| ByteRTCUserOfflineReasonDropped | 1 | 远端用户因网络等原因掉线,或切换至不可见状态。 |
typedef NS_ENUM(NSInteger, ByteRTCStreamRemoveReason)
房间内远端流移除原因。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCStreamRemoveReasonUnpublish | 0 | 远端用户停止发布流。 |
| ByteRTCStreamRemoveReasonPublishFailed | 1 | 远端用户发布流失败。 |
| ByteRTCStreamRemoveReasonKeepLiveFailed | 2 | 保活失败。 |
| ByteRTCStreamRemoveReasonClientDisconnected | 3 | 远端用户断网。 |
| ByteRTCStreamRemoveReasonRepublish | 4 | 远端用户重新发布流。 |
| ByteRTCStreamRemoveReasonOther | 5 | 其他原因。 |
typedef NS_ENUM(NSInteger, ByteRTCRoomProfile)
房间模式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCRoomProfileCommunication | 0 | 普通音视频通话模式。 单声道,采样率为 48kHz 你应在 1V1 音视频通话时,使用此设置。 此设置下,弱网抗性较好。 |
| ByteRTCRoomProfileLiveBroadcasting | 1 | 直播模式。 单声道,采样率为 48kHz。 当你对音视频通话的音质和画质要求较高时,应使用此设置。 此设置下,当用户使用蓝牙耳机收听时,蓝牙耳机使用媒体模式。 |
| ByteRTCRoomProfileGame | 2 | 游戏语音模式。 单声道,采样率为 16kHz。 低端机在此模式下运行时,进行了额外的性能优化: + 部分低端机型配置编码帧长 40/60 + 部分低端机型关闭软件 3A 音频处理 增强对 iOS 其他屏幕录制进行的兼容性,避免音频录制被 RTC 打断。 |
| ByteRTCRoomProfileCloudGame | 3 | 云游戏模式。 单声道,采样率为 48kHz。 如果你需要低延迟、高码率的设置时,你可以使用此设置。 此设置下,弱网抗性较差。 |
| ByteRTCRoomProfileLowLatency | 4 | 低时延模式。SDK 会使用低延时设置。 当你的场景非游戏或云游戏场景,又需要极低延时的体验时,可以使用该模式。 该模式下,音视频通话延时会明显降低,但同时弱网抗性、通话音质等均会受到一定影响。 在使用此模式前,强烈建议咨询技术支持同学。 |
typedef NS_ENUM(NSInteger, ByteRTCAudioScenarioType)
音频场景类型
选择音频场景后,SDK 会自动根据客户端音频采集播放设备和状态,适用通话音量/媒体音量。
你可以调用 setAudioScenario: 设置音频场景。
如果以下音频场景类型无法满足你的业务需要,请联系技术支持同学进行定制。
| 类型 | 值 | 说明 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ByteRTCAudioScenarioMusic | 0 | (默认)音乐场景 此场景适用于对音乐表现力有要求的场景,如音乐直播等。 音频采集播放设备和采集播放状态,到音量类型的映射如下:
|
||||||||||||||||||||
| ByteRTCAudioScenarioHighqualityCommunication | 1 | 高质量通话场景。 此场景适用于对音乐表现力有要求,但又希望能够使用蓝牙耳机上自带的麦克风进行音频采集的场景。 此场景可以兼顾外放/使用蓝牙耳机时的音频体验,并避免使用蓝牙耳机时音量类型切换导致的听感突变。 音频采集播放设备和采集播放状态,到音量类型的映射如下:
|
||||||||||||||||||||
| ByteRTCAudioScenarioCommunication | 2 | 纯通话音量场景 此场景下,无论客户端音频路由情况和发布订阅状态,全程使用通话音量。 适用于需要频繁上下麦的通话或会议场景。 此场景可以保持统一的音频模式,不会有音量突变的听感; 最大程度地消除回声,使通话清晰度达到最优; 使用蓝牙耳机时,能够使用蓝牙耳机上自带的麦克风进行音频采集。 但是,会压低使用媒体音量进行播放的其他音频的音量,且音质会变差。 |
||||||||||||||||||||
| ByteRTCAudioScenarioMedia | 3 | 纯媒体场景(一般不建议使用) 此场景下,无论客户端音频采集播放设备和采集播放状态,全程使用媒体音量。 |
||||||||||||||||||||
| ByteRTCAudioScenarioGameStreaming | 4 | 游戏媒体场景 此场景下,蓝牙耳机时使用通话音量,其它设备使用媒体音量。 外放通话且无游戏音效消除优化时,极易出现回声和啸叫。 |
typedef NS_ENUM(NSInteger, ByteRTCVoiceChangerType)
变声特效类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVoiceChangerOriginal | 0 | 原声,不含特效 |
| ByteRTCVoiceChangerGiant | 1 | 巨人 |
| ByteRTCVoiceChangerChipmunk | 2 | 花栗鼠 |
| ByteRTCVoiceChangerMinionst | 3 | 小黄人 |
| ByteRTCVoiceChangerVibrato | 4 | 颤音 |
| ByteRTCVoiceChangerRobot | 5 | 机器人 |
typedef NS_ENUM(NSInteger, ByteRTCVoiceReverbType)
混响特效类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVoiceReverbOriginal | 0 | 原声,不含特效 |
| ByteRTCVoiceReverbEcho | 1 | 回声 |
| ByteRTCVoiceReverbConcert | 2 | 演唱会 |
| ByteRTCVoiceReverbEthereal | 3 | 空灵 |
| ByteRTCVoiceReverbKTV | 4 | KTV |
| ByteRTCVoiceReverbStudio | 5 | 录音棚 |
typedef NS_ENUM(NSInteger, ByteRTCAudioProfileType)
音质档位 调用 setAudioProfile: 设置的音质档位
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioProfileDefault | 0 | 默认音质 服务器下发或客户端已设置的 ByteRTCRoomProfile 的音质配置 |
| ByteRTCAudioProfileFluent | 1 | 流畅音质。 单声道,采样率为 16kHz,编码码率为 24kbps。 流畅优先、低延迟、低功耗、低流量消耗,适用于大部分游戏场景,如 MMORPG、MOBA、FPS 等游戏中的小队语音、组队语音、国战语音等。 |
| ByteRTCAudioProfileStandard | 2 | 标准音质。 单声道,采样率为 48kHz,编码码率为 48kbps。 适用于对音质有一定要求的场景,同时延时、功耗和流量消耗相对适中,适合教育场景和 Sirius 等狼人杀类游戏。 |
| ByteRTCAudioProfileHD | 3 | 高清音质 双声道,采样率为 48kHz,编码码率为 128kbps。 超高音质,同时延时、功耗和流量消耗相对较大,适用于连麦 PK 等音乐场景。 游戏场景不建议使用。 |
typedef NS_ENUM(NSInteger, ByteRTCConnectionState)
SDK 与信令服务器连接状态。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCConnectionStateDisconnected | 1 | 连接中断。 |
| ByteRTCConnectionStateConnecting | 2 | 首次连接,正在连接中。 |
| ByteRTCConnectionStateConnected | 3 | 首次连接成功。 |
| ByteRTCConnectionStateReconnecting | 4 | 连接断开后重新连接中。 |
| ByteRTCConnectionStateReconnected | 5 | 连接断开后重连成功。 |
| ByteRTCConnectionStateLost | 6 | 网络连接断开超过 10 秒,仍然会继续重连。 |
typedef NS_ENUM(NSInteger, ByteRTCNetworkType)
SDK 网络连接类型。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCNetworkTypeUnknown | -1 | 网络连接类型未知。 |
| ByteRTCNetworkTypeDisconnected | 0 | 网络连接已断开。 |
| ByteRTCNetworkTypeLAN | 1 | 网络连接类型为 LAN 。 |
| ByteRTCNetworkTypeWIFI | 2 | 网络连接类型为 Wi-Fi(包含热点)。 |
| ByteRTCNetworkTypeMobile2G | 3 | 网络连接类型为 2G 移动网络。 |
| ByteRTCNetworkTypeMobile3G | 4 | 网络连接类型为 3G 移动网络。 |
| ByteRTCNetworkTypeMobile4G | 5 | 网络连接类型为 4G 移动网络。 |
| ByteRTCNetworkTypeMobile5G | 6 | 网络连接类型为 5G 移动网络。 |
typedef NS_ENUM(NSUInteger, ByteRTCNetworkDetectionStopReason)
通话前探测的停止原因 rtcEngine:onNetworkDetectionStopped: 回调的参数类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCNetworkDetectionStopReasonUser | 0 | 用户主动停止。 |
| ByteRTCNetworkDetectionStopReasonTimeout | 1 | 探测超过三分钟。 |
| ByteRTCNetworkDetectionStopReasonConnectionLost | 2 | 探测网络连接断开。 当超过 12s 没有收到回复,SDK 将断开网络连接,并且不再尝试重连。 |
| ByteRTCNetworkDetectionStopReasonStreaming | 3 | 本地开始推拉流,停止探测。 |
| ByteRTCNetworkDetectionStopReasonInnerErr | 4 | 网络探测失败,内部异常 |
typedef NS_ENUM(NSUInteger, ByteRTCNetworkDetectionLinkType)
通话前探测链接的类型 rtcEngine:onNetworkDetectionResult:quality:rtt:lostRate:bitrate:jitter: 回调的参数类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCNetworkDetectionLinkTypeUp | 0 | 上行网络探测。 |
| ByteRTCNetworkDetectionLinkTypeDown | 1 | 下行网络探测。 |
typedef NS_ENUM(NSInteger, ByteRTCVideoStreamType)
视频流类型 目前C++ SDK 只支持 ByteRTCVideoStreamTypeHigh 类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoStreamTypeHigh | 0 | 高分辨率视频流 |
| ByteRTCVideoStreamTypeLow | 1 | 低分辨率视频 |
typedef NS_ENUM(NSUInteger, ByteRTCNetworkQuality)
媒体流网络质量。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCNetworkQualityUnknown | 0 | 网络质量未知。 |
| ByteRTCNetworkQualityExcellent | 1 | 网络质量极好。 |
| ByteRTCNetworkQualityGood | 2 | 主观感觉和 kNetworkQualityExcellent 差不多,但码率可能略低。 |
| ByteRTCNetworkQualityPoor | 3 | 主观感受有瑕疵但不影响沟通。 |
| ByteRTCNetworkQualityBad | 4 | 勉强能沟通但不顺畅。 |
| ByteRTCNetworkQualityVeryBad | 5 | 网络质量非常差,基本不能沟通。 |
typedef NS_ENUM(NSInteger, ByteRTCVideoStreamState)
设置本地视频属性的返回状态。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoStreamStateSuccess | 0 | 设置本地视频属性成功 |
| ByteRTCVideoStreamStateInvalid | -2 | 本地视频属性参数不合法 |
typedef NS_ENUM(NSInteger, ByteRTCPerformanceAlarmReason)
性能回退或者恢复的原因
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCPerformanceAlarmReasonBandwidthFallback | 0 | 网络原因差,造成了发送性能回退。仅在开启发送性能回退时,会收到此原因。 |
| ByteRTCPerformanceAlarmReasonBandwidthResumed | 1 | 网络性能恢复,发送性能回退恢复。仅在开启发送性能回退时,会收到此原因。 |
| ByteRTCPerformanceAlarmReasonFallback | 2 | 如果未开启发送性能回退,收到此告警时,意味着性能不足; 如果开启了发送性能回退,收到此告警时,意味着性能不足,且已发生发送性能回退。 |
| ByteRTCPerformanceAlarmReasonResumed | 3 | 如果未开启发送性能回退,收到此告警时,意味着性能不足已恢复; 如果开启了发送性能回退,收到此告警时,意味着性能不足已恢复,且已发生发送性能回退恢复。 |
typedef NS_ENUM(NSInteger, ByteRTCPerformanceAlarmMode)
性能回退的模式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCPerformanceAlarmModeNormal | 0 | 未开启发布性能回退 |
| ByteRTCPerformanceAlarmModeSimulcast | 1 | 已开启发布性能回退 |
typedef NS_ENUM(NSInteger, ByteRTCVideoOutputOrientationMode)
视频输出方向模式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoOutputOrientationModeAdaptative | 0 | 自适应布局 |
| ByteRTCVideoOutputOrientationModeFixedLandscape | 1 | 横屏布局 |
| ByteRTCVideoOutputOrientationModeFixedPortrait | 2 | 竖屏布局 |
typedef NS_ENUM(NSUInteger, ByteRTCMirrorType)
镜像类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCMirrorTypeNone | 0 | 本地预览和编码传输时均无镜像效果 |
| ByteRTCMirrorTypeRender | 1 | 本地预览时有镜像效果,编码传输时无镜像效果 |
| ByteRTCMirrorTypeRenderAndEncoder | 3 | 本地预览和编码传输时均有镜像效果 |
typedef NS_ENUM(NSInteger, ByteRTCVideoRotation)
视频旋转信息,枚举类型,定义了以 90 度为间隔的四种旋转模式。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoRotation0 | 0 | 视频不做旋转 |
| ByteRTCVideoRotation90 | 90 | 视频顺时针旋转 90 度 |
| ByteRTCVideoRotation180 | 180 | 视频顺时针旋转 180 度 |
| ByteRTCVideoRotation270 | 270 | 视频顺时针旋转 270 度 |
typedef NS_ENUM(NSInteger, ByteRTCVideoStreamScaleMode)
视频帧缩放模式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoStreamScaleModeAuto | 0 | 自动缩放模式,默认设置为 ByteRTCVideoStreamScaleModeFitWithCropping。 |
| ByteRTCVideoStreamScaleModeStretch | 1 | 对视频帧进行缩放,直至充满和视窗分辨率一致为止。这一过程不保证等比缩放。 |
| ByteRTCVideoStreamScaleModeFitWithCropping | 2 | 视窗填满优先。 视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 |
| ByteRTCVideoStreamScaleModeFitWithFilling | 3 | 视频帧内容全部显示优先。 视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。保持纵横比来缩放图像,填充短边 |
typedef NS_ENUM(NSInteger, ByteRTCVideoCodecType)
视频编码类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoCodecTypeUnknown | 0 | 未知类型 |
| ByteRTCVideoCodecTypeH264 | 1 | 标准 H264 编码器 |
| ByteRTCVideoCodecTypeByteVC1 | 2 | 标准 ByteVC1 编码器 |
typedef NS_ENUM(NSInteger, ByteRTCVideoPictureType)
编码帧类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoPictureTypeUnknown | 0 | 未知类型 |
| ByteRTCVideoPictureTypeI | 1 | I帧,关键帧,编解码不需要参考其他视频帧 |
| ByteRTCVideoPictureTypeP | 2 | P帧,向前参考帧,编解码需要参考前一帧视频帧 |
| ByteRTCVideoPictureTypeB | 3 | B帧,前后参考帧,编解码需要参考前后两帧视频帧 |
typedef NS_ENUM(NSInteger, ByteRTCVideoEncoderPreference)
编码策略偏好
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoEncoderPreferenceDisabled | 0 | 无偏好 |
| ByteRTCVideoEncoderPreferenceMaintainFramerate | 1 | 帧率优先 |
| ByteRTCVideoEncoderPreferenceMaintainQuality | 2 | 质量优先 |
| ByteRTCVideoEncoderPreferenceBalance | 3 | 平衡质量与帧率 |
typedef NS_ENUM(NSInteger, ByteRTCUserMessageSendResult)
消息发送结果。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCUserMessageSendResultSuccess | 0 | 向房间内单个用户发送消息成功 |
| ByteRTCUserMessageSendResultTimeout | 1 | 发送超时,没有发送。 |
| ByteRTCUserMessageSendResultBroken | 2 | 通道断开,没有发送 |
| ByteRTCUserMessageSendResultNoReceiver | 3 | 找不到接收方 |
| ByteRTCUserMessageSendResultNoRelayPath | 4 | 获取级联路径失败 |
| ByteRTCUserMessageSendResultNotJoin | 100 | 消息发送方没有加入房间 |
| ByteRTCUserMessageSendResultInit | 101 | 连接未完成初始化 |
| ByteRTCUserMessageSendResultNoConnection | 102 | 没有可用的数据传输通道连接 |
| ByteRTCUserMessageSendResultExceedMaxLength | 103 | 消息超过最大长度,当前为64KB |
| ByteRTCUserMessageSendResultEmptyUser | 104 | 接收消息的单个用户 id 为空 |
| ByteRTCUserMessageSendResultNotLogin | 105 | 房间外或业务服务器消息发送方没有登录 |
| ByteRTCUserMessageSendResultServerParamsNotSet | 106 | 发送消息给业务方服务器之前没有设置参数 |
| ByteRTCUserMessageSendResultUnknown | 1000 | 失败,未知错误。 |
typedef NS_ENUM(NSInteger, ByteRTCUserOnlineStatus)
用户在线状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCUserOnlineStatusOffline | 0 | 对端用户离线 对端用户已经调用 logout,或者没有调用 login:uid: 进行登录 |
| ByteRTCUserOnlineStatusOnline | 1 | 对端用户在线 对端用户调用 login:uid: 登录,并且连接状态正常 |
| ByteRTCUserOnlineStatusUnreachable | 2 | 无法获取对端用户在线状态 发生级联错误、对端用户在线状态异常时返回 |
typedef NS_ENUM(NSInteger, ByteRTCRoomMessageSendResult)
广播消息发送结果。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCRoomMessageSendResultSuccess | 200 | 向房间内所有用户发送消息成功 |
| ByteRTCRoomMessageSendResultNotJoin | 100 | 失败,没有加入房间。 |
| ByteRTCRoomMessageSendResultInit | 101 | 失败,连接未完成初始化。 |
| ByteRTCRoomMessageSendResultNoConnection | 102 | 失败,没有可用的连接。 |
| ByteRTCRoomMessageSendResultExceedMaxLength | 103 | 消息超过最大长度,当前为64KB |
| ByteRTCRoomMessageSendResultUnknown | 1000 | 失败,未知错误。 |
typedef NS_ENUM(NSUInteger, ByteRTCPublishFallbackOption)
本地发布的音视频流回退选项
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCPublishFallbackOptionDisabled | 0 | 关闭发送视频流时的性能回退功能,默认值 |
| ByteRTCPublishFallbackOptionSimulcast | 1 | 开启在网络情况不佳或设备性能不足时只发送小流的功能 |
typedef NS_ENUM(NSUInteger, ByteRTCSubscribeFallbackOption)
订阅回退选项
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCSubscribeFallbackOptionDisabled | 0 | 下行网络较弱时,关闭订阅音视频流时的性能回退功能,默认值 |
| ByteRTCSubscribeFallbackOptionVideoStreamLow | 1 | 下行网络较弱时只接收视频小流 |
| ByteRTCSubscribeFallbackOptionAudioOnly | 2 | 下行网络较弱时,先尝试只接收视频小流;如果网络环境无法显示视频,则再回退到只接收远端订阅的音频流 |
typedef NS_ENUM(NSUInteger, ByteRTCRemoteUserPriority)
远端用户优先级。在性能不足需要回退时,会先回退优先级低的用户的音视频流
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCRemoteUserPriorityLow | 0 | 用户优先级为低,默认值 |
| ByteRTCRemoteUserPriorityMedium | 100 | 用户优先级为正常 |
| ByteRTCRemoteUserPriorityHigh | 200 | 用户优先级为高 |
typedef NS_ENUM(NSInteger, ByteRTCFallbackOrRecoverReason)
本地用户订阅的远端流触发回退策略的原因。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCFallbackOrRecoverReasonUnknown | -1 | 其他原因,非带宽和性能原因引起的回退或恢复。默认值 |
| ByteRTCFallbackOrRecoverReasonSubscribeFallbackByBandwidth | 0 | 由带宽不足导致的订阅端音视频流回退。 |
| ByteRTCFallbackOrRecoverReasonSubscribeFallbackByPerformance | 1 | 由性能不足导致的订阅端音视频流回退。 |
| ByteRTCFallbackOrRecoverReasonSubscribeRecoverByBandwidth | 2 | 由带宽恢复导致的订阅端音视频流恢复。 |
| ByteRTCFallbackOrRecoverReasonSubscribeRecoverByPerformance | 3 | 由性能恢复导致的订阅端音视频流恢复。 |
| ByteRTCFallbackOrRecoverReasonPublishFallbackByBandwidth | 4 | 由带宽不足导致的发布端音视频流回退。 |
| ByteRTCFallbackOrRecoverReasonPublishFallbackByPerformance | 5 | 由性能不足导致的发布端音视频流回退。 |
| ByteRTCFallbackOrRecoverReasonPublishRecoverByBandwidth | 6 | 由带宽恢复导致的发布端音视频流恢复。 |
| ByteRTCFallbackOrRecoverReasonPublishRecoverByPerformance | 7 | 由性能恢复导致的发布端音视频流恢复。 |
typedef NS_ENUM(NSInteger, ByteRTCLocalAudioStreamState)
本地音频流状态。
SDK 通过 rtcEngine:onLocalAudioStateChanged:error: 回调该状态。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCLocalAudioStreamStateStopped | 0 | 本地音频默认初始状态。 麦克风停止工作时回调该状态,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorOk |
| ByteRTCLocalAudioStreamStateRecording | 1 | 本地音频录制设备启动成功。 采集到音频首帧时回调该状态,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorOk |
| ByteRTCLocalAudioStreamStateEncoding | 2 | 本地音频首帧编码成功。 音频首帧编码成功时回调该状态,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorOk |
| ByteRTCLocalAudioStreamStateFailed | 3 | 本地音频启动失败,在以下时机回调该状态: + 本地录音设备启动失败,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorRecordFailure + 检测到没有录音设备权限,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorDeviceNoPermission + 音频编码失败,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamError |
typedef NS_ENUM(NSInteger, ByteRTCLocalAudioStreamError)
本地音频流状态改变时的错误码。 SDK 通过 rtcEngine:onLocalAudioStateChanged:error: 回调该错误码。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCLocalAudioStreamErrorOk | 0 | 本地音频状态正常 |
| ByteRTCLocalAudioStreamErrorFailure | 1 | 本地音频出错原因未知 |
| ByteRTCLocalAudioStreamErrorDeviceNoPermission | 2 | 没有权限启动本地音频录制设备 |
| ByteRTCLocalAudioStreamErrorRecordFailure | 4 | 本地音频录制失败,建议你检查录制设备是否正常工作 |
| ByteRTCLocalAudioStreamErrorEncodeFailure | 5 | 本地音频编码失败 |
| ByteRTCLocalAudioStreamErrorNoRecordingDevice | 6 | 没有可用的音频录制设备 |
typedef NS_ENUM(NSInteger, ByteRTCLocalVideoStreamState)
本地视频流状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCLocalVideoStreamStateStopped | 0 | 本地视频默认初始状态 摄像头停止工作时回调该状态,对应错误码 ByteRTCLocalVideoStreamError 中的 ByteRTCLocalVideoStreamErrorOk |
| ByteRTCLocalVideoStreamStateRecording | 1 | 本地视频录制设备启动成功 采集到视频首帧时回调该状态,对应错误码 ByteRTCLocalVideoStreamError 中的 ByteRTCLocalVideoStreamErrorOk |
| ByteRTCLocalVideoStreamStateEncoding | 2 | 本地视频首帧编码成功 本地视频首帧编码成功时回调该状态,对应错误码 ByteRTCLocalVideoStreamError 中的 ByteRTCLocalVideoStreamErrorOk |
| ByteRTCLocalVideoStreamStateFailed | 3 | 本地视频启动失败, 在以下时机回调该状态: + 本地采集设备启动失败,对应错误码 ByteRTCLocalVideoStreamError 中的 ByteRTCLocalVideoStreamErrorCaptureFailure + 检测到没有摄像头权限,对应错误码 ByteRTCLocalVideoStreamError 中的 ByteRTCLocalVideoStreamErrorDeviceNoPermission + 视频编码失败,对应错误码 ByteRTCLocalVideoStreamError 中的 ByteRTCLocalVideoStreamErrorEncodeFailure |
typedef NS_ENUM(NSInteger, ByteRTCLocalVideoStreamError)
本地视频状态改变时的错误码
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCLocalVideoStreamErrorOk | 0 | 本地视频状态正常(本地视频状态改变正常时默认返回值) |
| ByteRTCLocalVideoStreamErrorFailure | 1 | 本地视频流发布失败 |
| ByteRTCLocalVideoStreamErrorDeviceNoPermission | 2 | 没有权限启动本地视频采集设备 |
| ByteRTCLocalVideoStreamErrorDeviceBusy | 3 | 本地视频采集设备被占用 |
| ByteRTCLocalVideoStreamErrorDeviceNotFound | 4 | 本地视频采集设备不存在或已移除 |
| ByteRTCLocalVideoStreamErrorCaptureFailure | 5 | 本地视频采集失败,建议检查采集设备是否正常工作 |
| ByteRTCLocalVideoStreamErrorEncodeFailure | 6 | 本地视频编码失败 |
| ByteRTCLocalVideoStreamErrorDeviceDisconnected | 7 | 本地视频采集设备被移除 |
typedef NS_ENUM(NSInteger, ByteRTCRemoteAudioState)
用户订阅的远端音频流状态。
SDK 通过 rtcEngine:onRemoteAudioStateChanged:state:reason: 回调该状态。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCRemoteAudioStateStopped | 0 | 远端音频流默认初始状态,在以下时机回调该状态: + 本地用户停止接收远端音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonLocalMuted + 远端用户停止发送音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonRemoteMuted + 远端用户离开房间,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonRemoteOffline |
| ByteRTCRemoteAudioStateStarting | 1 | 开始接收远端音频流首包。 刚收到远端音频流首包时,会触发回调 rtcEngine:onRemoteAudioStateChanged:state:reason:, 对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonLocalUnmuted |
| ByteRTCRemoteAudioStateDecoding | 2 | 远端音频流正在解码,正常播放,在以下时机回调该状态: + 成功解码远端音频首帧,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonLocalUnmuted + 网络由阻塞恢复正常,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonNetworkRecovery + 本地用户恢复接收远端音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonLocalUnmuted + 远端用户恢复发送音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonRemoteUnmuted |
| ByteRTCRemoteAudioStateFrozen | 3 | 远端音频流卡顿。 网络阻塞导致丢包率大于 40% 时,会触发回调 rtcEngine:onRemoteAudioStateChanged:state:reason:, 对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonNetworkCongestion |
typedef NS_ENUM(NSInteger, ByteRTCRemoteAudioStateChangeReason)
接收远端音频流状态改变的原因。
用户可以通过 rtcEngine:onRemoteAudioStateChanged:state:reason: 了解该状态。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCRemoteAudioStateChangeReasonInternal | 0 | 内部原因 |
| ByteRTCRemoteAudioStateChangeReasonNetworkCongestion | 1 | 网络阻塞 |
| ByteRTCRemoteAudioStateChangeReasonNetworkRecovery | 2 | 网络恢复正常 |
| ByteRTCRemoteAudioStateChangeReasonLocalMuted | 3 | 本地用户停止接收远端音频流 |
| ByteRTCRemoteAudioStateChangeReasonLocalUnmuted | 4 | 本地用户恢复接收远端音频流 |
| ByteRTCRemoteAudioStateChangeReasonRemoteMuted | 5 | 远端用户停止发送音频流 |
| ByteRTCRemoteAudioStateChangeReasonRemoteUnmuted | 6 | 远端用户恢复发送音频流 |
| ByteRTCRemoteAudioStateChangeReasonRemoteOffline | 7 | 远端用户离开房间 |
typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoState)
远端视频流状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCRemoteVideoStateStopped | 0 | 远端视频流默认初始状态, 在以下时机回调该状态: + 本地用户停止接收远端视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonLocalMuted + 远端用户停止发送视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonRemoteMuted + 远端用户离开房间,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonRemoteOffline |
| ByteRTCRemoteVideoStateStarting | 1 | 本地用户已接收远端视频首包 收到远端视频首包时回调该状态,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted |
| ByteRTCRemoteVideoStateDecoding | 2 | 远端视频流正在解码,正常播放, 在以下时机回调该状态: + 成功解码远端视频首帧,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted + 网络由阻塞恢复正常,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonNetworkRecovery + 本地用户恢复接收远端视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted + 远端用户恢复发送视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonRemoteUnmuted |
| ByteRTCRemoteVideoStateFrozen | 3 | 远端视频流卡顿 网络阻塞、丢包率等原因造成视频卡顿流时会回报该状态,对应错误码 ByteRTCRemoteVideoStateChangeReason 中的 ByteRTCRemoteVideoStateChangeReasonNetworkCongestion |
| ByteRTCRemoteVideoStateFailed | 4 | 远端音频流播放失败 |
typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoStateChangeReason)
远端视频流状态改变的原因
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCRemoteVideoStateChangeReasonInternal | 0 | 内部原因 |
| ByteRTCRemoteVideoStateChangeReasonNetworkCongestion | 1 | 网络阻塞 |
| ByteRTCRemoteVideoStateChangeReasonNetworkRecovery | 2 | 网络恢复正常 |
| ByteRTCRemoteVideoStateChangeReasonLocalMuted | 3 | 本地用户停止接收远端视频流或本地用户禁用视频模块 |
| ByteRTCRemoteVideoStateChangeReasonLocalUnmuted | 4 | 本地用户恢复接收远端视频流或本地用户启用视频模块 |
| ByteRTCRemoteVideoStateChangeReasonRemoteMuted | 5 | 远端用户停止发送视频流或远端用户禁用视频模块 |
| ByteRTCRemoteVideoStateChangeReasonRemoteUnmuted | 6 | 远端用户恢复发送视频流或远端用户启用视频模块 |
| ByteRTCRemoteVideoStateChangeReasonRemoteOffline | 7 | 远端用户离开房间 |
typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceType)
当前媒体设备类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCMediaDeviceTypeAudioUnknown | -1 | 未知音频设备 |
| ByteRTCMediaDeviceTypeAudioRenderDevice | 0 | 音频渲染设备类型 |
| ByteRTCMediaDeviceTypeAudioCaptureDevice | 1 | 音频采集设备类型 |
| ByteRTCMediaDeviceTypeVideoCaptureDevice | 3 | 视频采集设备类型 |
| ByteRTCMediaDeviceTypeScreenAudioCaptureDevice | 5 | 屏幕流音频设备 |
typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceState)
媒体设备状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCMediaDeviceStateStarted | 1 | 设备已开启 |
| ByteRTCMediaDeviceStateStopped | 2 | 设备已停止 |
| ByteRTCMediaDeviceStateRuntimeError | 3 | 设备运行时错误 |
| ByteRTCMediaDeviceStateAdded | 10 | 设备已插入 |
| ByteRTCMediaDeviceStateRemoved | 11 | 设备被移除 |
typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceError)
媒体设备错误类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCMediaDeviceErrorOK | 0 | 媒体设备正常 |
| ByteRTCMediaDeviceErrorDeviceNoPermission | 1 | 没有权限启动媒体设备 |
| ByteRTCMediaDeviceErrorDeviceBusy | 2 | 媒体设备已经在使用中 |
| ByteRTCMediaDeviceErrorDeviceFailure | 3 | 媒体设备错误 |
| ByteRTCMediaDeviceErrorDeviceNotFound | 4 | 未找到指定的媒体设备 |
| ByteRTCMediaDeviceErrorDeviceDisconnected | 5 | 媒体设备被移除 |
| ByteRTCMediaDeviceErrorDeviceNoCallback | 6 | 设备没有数据回调 |
| ByteRTCMediaDeviceErrorUNSupportFormat | 7 | 设备采样率不支持 |
typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceWarning)
媒体设备警告
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCMediaDeviceWarningOK | 0 | 无警告 |
| ByteRTCMediaDeviceWarningOperationDenied | 1 | 非法设备操作。在使用外部设备时,调用了 SDK 内部设备 API。 |
| ByteRTCMediaDeviceWarningCaptureSilence | 2 | 采集静音。 |
typedef NS_OPTIONS(NSUInteger, ByteRTCProblemFeedbackOption)
音视频质量反馈问题类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCProblemFeedbackOptionNone | 0 | 没有问题 |
| ByteRTCProblemFeedbackOptionOtherMessage | (1 << 0) | 其他问题 |
| ByteRTCProblemFeedbackOptionAudioNotClear | (1 << 1) | 声音不清晰 |
| ByteRTCProblemFeedbackOptionVideoNotClear | (1 << 2) | 视频不清晰 |
| ByteRTCProblemFeedbackOptionNotSync | (1 << 3) | 音视频不同步 |
| ByteRTCProblemFeedbackOptionAudioLagging | (1 << 4) | 音频卡顿 |
| ByteRTCProblemFeedbackOptionVideoLagging | (1 << 5) | 视频卡顿 |
| ByteRTCProblemFeedbackOptionDisconnected | (1 << 6) | 连接断开 |
| ByteRTCProblemFeedbackOptionNoAudio | (1 << 7) | 无声音 |
| ByteRTCProblemFeedbackOptionNoVideo | (1 << 8) | 无画面 |
| ByteRTCProblemFeedbackOptionAudioStrength | (1 << 9) | 声音过小 |
| ByteRTCProblemFeedbackOptionEcho | (1 << 10) | 回声噪音 |
| ByteRTCFeedBackProblemTypeEarBackDelay | (1 << 11) | 耳返延迟大 |
typedef NS_ENUM(NSUInteger, ByteRTCFirstFrameSendState)
首帧发送状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCFirstFrameSendStateSending | 0 | 发送中 |
| ByteRTCFirstFrameSendStateSent | 1 | 发送成功 |
| ByteRTCFirstFrameSendStateEnd | 2 | 发送失败 |
typedef NS_ENUM(NSUInteger, ByteRTCFirstFramePlayState)
首帧播放状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCFirstFramePlayStatePlaying | 0 | |
| ByteRTCFirstFramePlayStatePlay | 1 | |
| ByteRTCFirstFramePlayStateEnd | 2 |
typedef NS_OPTIONS(NSUInteger, ByteRTCEncryptType)
自定义加密类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCEncryptTypeCustomize | 0 | 不使用内置加密。默认值。 |
| ByteRTCEncryptTypeAES128CBC | 1 | AES-128-CBC 加密算法 |
| ByteRTCEncryptTypeAES256CBC | 2 | AES-256-CBC 加密算法 |
| ByteRTCEncryptTypeAES128ECB | 3 | AES-128-ECB 加密算法 |
| ByteRTCEncryptTypeAES256ECB | 4 | AES-256-ECB 加密算法 |
typedef NS_ENUM(NSUInteger, ByteRTCDataFrameType)
数据类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCDataFrameTypeSei | 0 | SEI 数据 |
| ByteRTCDataFrameTypeRoi | 1 | 人脸识别数据 |
| ByteRTCDataFrameTypeOther | 2 | 其他数据帧类型 |
@interface ByteRTCVideoCanvas : NSObject
画布信息和渲染模式。
| 类型 | 名称 |
|---|---|
| UIView* | view |
| ByteRTCRenderMode | renderMode |
| NSString* | roomId |
| NSString* | uid |
@property (strong, nonatomic) UIView* _Nullable view;
本地视图句柄
@property (assign, nonatomic) ByteRTCRenderMode renderMode;
渲染模式,参看 ByteRTCRenderMode
@property (strong, nonatomic) NSString* _Nullable roomId;
视图所在的房间 ID
@property (strong, nonatomic) NSString* _Nullable uid;
视图对应的用户 ID
@interface ByteRTCFrameExtendedData : NSObject
视频帧附加的数据,视频解码后获得的附加数据
| 类型 | 名称 |
|---|---|
| ByteRTCDataFrameType | frameType |
| NSData* | extendedData |
| NSInteger | extendedDataLen |
@property (assign, nonatomic) ByteRTCDataFrameType frameType;
数据类型,详见 ByteRTCDataFrameType。
@property (strong, nonatomic) NSData * _Nullable extendedData;
附加数据
@property (assign, nonatomic) NSInteger extendedDataLen;
附加数据长度
@interface ByteRTCVideoSolution: NSObject
视频流参数
| 类型 | 名称 |
|---|---|
| CGSize | videoSize |
| NSInteger | frameRate |
| NSInteger | maxKbps |
| ByteRTCVideoStreamScaleMode | mode |
| ByteRTCVideoEncoderPreference | encoderPreference |
@property (nonatomic, assign) CGSize videoSize;
视频分辨率
@property (nonatomic, assign) NSInteger frameRate;
视频预设帧率
@property (nonatomic, assign) NSInteger maxKbps;
最高编码码率(千比特每秒)
建议使用预估值。
@property (nonatomic, assign) ByteRTCVideoStreamScaleMode mode;
视频帧缩放模式。你可以设置缩放以适应视窗,参见 ByteRTCVideoStreamScaleMode
@property (nonatomic, assign) ByteRTCVideoEncoderPreference encoderPreference;
视频编码质量策略,参见 ByteRTCVideoEncoderPreference
typedef NS_ENUM(NSInteger, ByteRTCVideoCapturePreference)
视频采集模式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoCapturePreferenceAuto | 0 | (默认)自动设置采集参数。 SDK在开启采集时根据服务端下发的采集配置结合编码参数设置最佳采集参数。 |
| ByteRTCVideoCapturePreferenceMannal | 1 | 手动设置采集参数,包括采集分辨率、帧率。 |
| ByteRTCVideoCapturePreferenceAutoPerformance | 2 | 采集参数与编码参数一致,即在 setVideoEncoderConfig:config: 中设置的参数。 |
@interface ByteRTCVideoCaptureConfig: NSObject
视频采集参数
| 类型 | 名称 |
|---|---|
| ByteRTCVideoCapturePreference | preference |
| CGSize | videoSize |
| NSInteger | frameRate |
@property(nonatomic, assign) ByteRTCVideoCapturePreference preference;
视频采集模式,参看 ByteRTCVideoCapturePreference
@property (nonatomic, assign) CGSize videoSize;
视频采集分辨率
@property (nonatomic, assign) NSInteger frameRate;
视频采集帧率,单位:fps。
@protocol ByteRTCStream <NSObject>
流属性。
| 类型 | 名称 |
|---|---|
| NSString* | userId |
| BOOL | isScreen |
| BOOL | hasVideo |
| BOOL | hasAudio |
| NSArray |
videoStreamDescriptions |
@property (nonatomic, copy, readonly) NSString * userId;
发布此流的用户 ID 。
@property (nonatomic, assign, readonly) BOOL isScreen;
此流是否为共享屏幕流。
@property (nonatomic, assign, readonly) BOOL hasVideo;
此流是否包括视频流。
@property (nonatomic, assign, readonly) BOOL hasAudio;
流是否包括音频流。
@property (nonatomic, copy, readonly) NSArray<ByteRTCVideoSolution *> * videoStreamDescriptions;
视频流的分辨率信息。
当远端用户调用 setVideoEncoderConfig:config: 方法发布多个配置的视频流时,此处会包含该用户发布的所有视频流的属性信息。
参看 ByteRTCVideoSolution。
@interface ByteRTCSubscribeConfig: NSObject
订阅流的参数配置。用户手动订阅一路音视频流所使用的订阅配置参数。
用户关闭自动订阅功能,使用手动订阅模式时,通过调用 subscribeUserStream:streamType:mediaType:videoConfig: 方法订阅音视频流,调用时传入的参数即为此数据类型。
| 类型 | 名称 |
|---|---|
| BOOL | isScreen |
| BOOL | subscribeVideo |
| BOOL | subscribeAudio |
| NSInteger | videoIndex |
@property (nonatomic, assign) BOOL isScreen;
是否是屏幕流。
用户通过设置此参数,订阅该远端用户发布的屏幕共享流或非屏幕共享流。 YES 为订阅屏幕共享流,NO 为订阅非屏幕共享流,默认值为 YES 。
@property (nonatomic, assign) BOOL subscribeVideo;
是否订阅视频。
用户通过设置此参数,选择是否订阅远端流中的视频。 YES 为订阅视频,NO 为不订阅视频,默认值为 YES 。
@property (nonatomic, assign) BOOL subscribeAudio;
是否订阅音频。
用户通过设置此参数,选择是否订阅远端流中的音频。YES 为订阅音频,NO 为不订阅音频,默认值为 YES 。
@property (nonatomic, assign) NSInteger videoIndex;
订阅的视频流分辨率下标。
用户可以通过调用 setVideoEncoderConfig:config: 方法在一路流中发布多个不同分辨率的视频。因此订阅流时,需要指定订阅的具体分辨率。此参数即用于指定需订阅的分辨率的下标,默认值为 0 。
typedef NS_ENUM(NSInteger, ByteRTCVideoFrameType)
视频帧类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoFrameTypeRawMemory | 0 | 视频帧类型:内存数据 |
| ByteRTCVideoFrameTypePixelBuffer | 0 | 视频帧类型:CVPixelBuffer |
typedef NS_ENUM(NSInteger, ByteRTCVideoPixelFormat)
视频帧格式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoPixelFormatUnknown | 0 | 未知格式 |
| ByteRTCVideoPixelFormatI420 | 1 | I420 |
| ByteRTCVideoPixelFormatBGRA | 2 | BGRA |
| ByteRTCVideoPixelFormatNV21 | 3 | NV21 |
| ByteRTCVideoPixelFormatRGBA | 4 | RGBA |
| ByteRTCVideoPixelFormatIMC2 | 5 | IMC2 |
| ByteRTCVideoPixelFormatARGB | 7 | ARGB |
| ByteRTCVideoPixelFormatNV12 | 8 | NV12 |
| ByteRTCVideoPixelFormatGLTexture2D | 10 | Opengl Texture2D纹理 |
| ByteRTCVideoPixelFormatGLTextureOES | 11 | Opengl OES纹理 |
| ByteRTCVideoPixelFormatCVPixelBuffer | 12 | CVPixelBuffer |
typedef NS_ENUM(NSInteger, ByteRTCVideoSinkPixelFormat)
视频帧编码格式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoSinkPixelFormatOriginal | 0 | 原始视频帧格式 |
| ByteRTCVideoSinkPixelFormatI420 | 1 | YUV I420 格式 |
| ByteRTCVideoSinkPixelFormatBGRA | 2 | BGRA 格式 |
| ByteRTCVideoSinkPixelFormatNV12 | 8 | YUV NV21 格式 |
typedef NS_ENUM(NSUInteger, ByteRTCStreamMixingType)
| 类型 | 值 | 说明 |
|---|---|---|
| StreamMixingTypeByServer | 0 | 通过服务端转推 |
| StreamMixingTypeByClient | 1 | 端云一体转推 |
typedef NS_ENUM(NSUInteger, ByteRTCStreamMixingEvent)
| 类型 | 值 | 说明 |
|---|---|---|
| StreamMixingStart | 1 | 合流功能触发 |
| StreamMixingStartSuccess | 2 | 合流成功 |
| StreamMixingStartFailed | 3 | 合流启动失败 |
| StreamMixingStop | 4 | 合流结束 |
| StreamMixingChangeMixeType | 5 | 服务端合流/端云一体合流 |
| StreamMixingFirstAudioFrameByClientMixer | 6 | 收到合流音频首帧 |
| StreamMixingFirstVideoFrameByClientMixer | 7 | 收到合流视频首帧 |
| StreamMixingUpdateTimeout | 8 | 更新合流超时 |
| StreamMixingStartTimeout | 9 | 开始合流超时 |
@interface ByteRTCVideoFrame : NSObject
待 SDK 编码的视频数据
| 类型 | 名称 |
|---|---|
| int | format |
| CMTime | time |
| int | strideInPixels |
| int | width |
| int | height |
| CVPixelBufferRef | textureBuf |
| NSData* | dataBuf |
| int | cropLeft |
| int | cropTop |
| int | cropRight |
| int | cropBottom |
| ByteRTCVideoRotation | rotation |
| ByteRTCFrameExtendedData* | extendedData |
@property (assign, nonatomic) int format;
视频帧格式,参考 ByteRTCVideoPixelFormat
@property (assign, nonatomic) CMTime time;
当前帧的时间戳信息
@property (assign, nonatomic) int strideInPixels;
每一行像素占用的字节数
@property (assign, nonatomic) int width;
视频帧宽度
@property (assign, nonatomic) int height;
视频帧高度
@property (assign, nonatomic) CVPixelBufferRef _Nullable textureBuf;
CVPixelBufferRef 类型的数据,当 format 为 kPixelFormatCVPixelBuffer 时有效
@property (strong, nonatomic) NSData * _Nullable dataBuf;
视频帧内存块首地址
@property (assign, nonatomic) int cropLeft;
视频帧左侧被裁剪的尺寸(像素)
@property (assign, nonatomic) int cropTop;
视频帧上部被裁剪的尺寸(像素)
@property (assign, nonatomic) int cropRight;
视频帧右侧被裁剪的尺寸(像素)
@property (assign, nonatomic) int cropBottom;
视频帧底部被裁剪的尺寸(像素)
@property (assign, nonatomic) ByteRTCVideoRotation rotation;
视频帧旋转角度:0, 90, 180, 270
@property (strong, nonatomic) ByteRTCFrameExtendedData * _Nullable extendedData;
视频帧附加的数据
@interface ByteRTCEncodedVideoFrame : NSObject
视频帧信息
| 类型 | 名称 |
|---|---|
| ByteRTCVideoCodecType | codecType |
| ByteRTCVideoPictureType | pictureType |
| SInt64 | timestampUs |
| SInt64 | timestampDtsUs |
| int | width |
| int | height |
| ByteRTCVideoRotation | rotation |
| NSData* | data |
@property (assign, nonatomic) ByteRTCVideoCodecType codecType;
视频编码类型。参看 ByteRTCVideoCodecType
@property (assign, nonatomic) ByteRTCVideoPictureType pictureType;
视频帧类型。参看 ByteRTCVideoPictureType
@property (assign, nonatomic) SInt64 timestampUs;
视频采集时间戳,单位:微秒
@property (assign, nonatomic) SInt64 timestampDtsUs;
视频编码时间戳,单位:微秒
@property (assign, nonatomic) int width;
视频帧宽,单位:px
@property (assign, nonatomic) int height;
视频帧高,单位:px
@property (nonatomic, assign) ByteRTCVideoRotation rotation;
视频帧旋转角度。参看 ByteRTCVideoRotation
@property (strong, nonatomic) NSData * _Nonnull data;
视频帧数据指针地址
@interface ByteRTCVideoCompositingRegion : NSObject
单个视频流在合流中的布局信息。
开启转推直播功能后,在多路视频流合流时,你可以设置其中一路视频流在合流中的预设布局信息。
| 类型 | 名称 |
|---|---|
| NSString* | uid |
| NSString* | roomId |
| CGFloat | x |
| CGFloat | y |
| CGFloat | width |
| CGFloat | height |
| NSInteger | zOrder |
| BOOL | localUser |
| BOOL | screenStream |
| CGFloat | alpha |
| NSInteger | contentControl |
| ByteRTCRenderMode | renderMode |
@property (copy, nonatomic) NSString * _Nonnull uid;
视频流发布用户的用户 ID 。
@property (copy, nonatomic) NSString * _Nonnull roomId;
视频流发布用户的房间 ID 。
@property (assign, nonatomic) CGFloat x;
视频流对应区域左上角的横坐标相对整体画面的归一化比例,取值的范围为 [0.0, 1.0)。
@property (assign, nonatomic) CGFloat y;
视频流对应区域左上角的纵坐标相对整体画面的归一化比例,取值的范围为 [0.0, 1.0)。
@property (assign, nonatomic) CGFloat width;
视频流对应区域宽度相对整体画面的归一化比例,取值的范围为 (0.0, 1.0]。
@property (assign, nonatomic) CGFloat height;
视频流对应区域高度相对整体画面的归一化比例,取值的范围为 (0.0, 1.0]。
@property (assign, nonatomic) NSInteger zOrder;
用户视频布局在画布中的层级。0为底层,值越大越上层,范围为[0 - 100]。
@property (assign, nonatomic) BOOL localUser;
是否为本地用户
@property (assign, nonatomic) BOOL screenStream;
是否为屏幕流,默认为NO
@property (assign, nonatomic) CGFloat alpha;
透明度。范围为 [0.0, 1.0]。
@property (assign, nonatomic) NSInteger contentControl;
合流内容控制。默认值为 0 ,取值范围及含义如下:
@property (assign, nonatomic) ByteRTCRenderMode renderMode;
视频显示模式。详见 ByteRTCRenderMode 数据类型。
@interface ByteRTCVideoCompositingLayout : NSObject
视频流合流整体布局信息。
开启转推直播功能后,你可以设置参与合流的每路视频流的预设布局信息和合流背景信息等。
| 类型 | 名称 |
|---|---|
| NSString* | backgroundColor |
| NSArray |
regions |
| NSString* | appData |
@property (copy, nonatomic) NSString *_Nonnull backgroundColor;
画布的背景颜色。格式为 RGB 定义下的 Hex 值,如 #FFB6C1 表示浅粉色。默认值 #000000,表示为黑色
@property (copy, nonatomic) NSArray<ByteRTCVideoCompositingRegion *> * _Nonnull regions;
用户布局信息列表。每条流的具体布局详见 ByteRTCVideoCompositingRegion 数据类型。
@property (copy, nonatomic) NSString *_Nonnull appData;
透传的 App 数据。
@interface ByteRTCTranscodingVideoConfig : NSObject
视频转码配置参数。
| 类型 | 名称 |
|---|---|
| NSString* | codec |
| NSInteger | width |
| NSInteger | height |
| NSInteger | fps |
| NSInteger | gop |
| NSInteger | kBitRate |
| BOOL | lowLatency |
@property (copy, nonatomic) NSString * _Nonnull codec;
视频编码格式。H264 编码格式或自定义编码格式
@property (assign, nonatomic) NSInteger width;
合流视频宽度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 640。
@property (assign, nonatomic) NSInteger height;
合流视频高度。单位为 px,范围为 [2, 1080],必须是偶数。默认值为 480。
@property (assign, nonatomic) NSInteger fps;
合流视频帧率信息。
@property (assign, nonatomic) NSInteger gop;
视频 I 帧间隔。
@property (assign, nonatomic) NSInteger kBitRate;
合流视频码率,单位为 kbps 。
@property (assign, nonatomic) BOOL lowLatency;
是否使用低延时特性。
typedef NS_ENUM(NSInteger, ByteRTCAACProfile)
AAC 编码类型。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAACProfileLC | 0 | LC(默认) |
| ByteRTCAACProfileMain | 1 | MAIN |
| ByteRTCAACProfileHEv1 | 2 | HEv1 |
| ByteRTCAACProfileHEv2 | 3 | HEv2 |
@interface ByteRTCTranscodingAudioConfig : NSObject
音频转码配置参数。
| 类型 | 名称 |
|---|---|
| NSString* | codec |
| NSInteger | sampleRate |
| NSInteger | channels |
| NSInteger | kBitRate |
| ByteRTCAACProfile | profile |
@property (copy, nonatomic) NSString * _Nonnull codec;
音频编码格式。使用 AAC 编码格式。
@property (assign, nonatomic) NSInteger sampleRate;
音频采样率。单位为 kHz。可选取值:16, 32, 44.1, 48。
@property (assign, nonatomic) NSInteger channels;
声道数,可取 1 或 2。
@property (assign, nonatomic) NSInteger kBitRate;
音频码率。单位为 kbps。可选取值:16, 32, 64。
@property (assign, nonatomic) ByteRTCAACProfile profile;
AAC 等级,详见 ByteRTCAACProfile
@interface ByteRTCLiveTranscoding : NSObject
转推直播配置参数。
| 类型 | 名称 |
|---|---|
| ByteRTCStreamMixingType | expectedMixingType |
| ByteRTCVideoCompositingLayout* | layout |
| ByteRTCTranscodingVideoConfig* | video |
| ByteRTCTranscodingAudioConfig* | audio |
| NSMutableDictionary* | authInfo |
| NSString* | url |
| NSString* | roomId |
| NSString* | userId |
| 返回 | 名称 |
|---|---|
| instancetype | defaultTranscoding |
@property (assign, nonatomic) ByteRTCStreamMixingType expectedMixingType;
合流类型,详见 ByteRTCStreamMixingType 数据类型。
@property (strong, nonatomic) ByteRTCVideoCompositingLayout * _Nonnull layout;
视频流合流整体布局信息。
开启转推直播功能后,你可以设置参与合流的每路视频流的预设布局信息和合流背景信息等。详见 ByteRTCVideoCompositingLayout 数据类型。
@property (strong, nonatomic) ByteRTCTranscodingVideoConfig * _Nonnull video;
视频转码配置参数。详见 ByteRTCTranscodingVideoConfig 数据类型。
@property (strong, nonatomic) ByteRTCTranscodingAudioConfig * _Nonnull audio;
音频转码配置参数。详见 ByteRTCTranscodingAudioConfig 数据类型。
@property (strong, nonatomic) NSMutableDictionary * _Nullable authInfo;
业务透传鉴权信息
@property (copy, nonatomic) NSString * _Nullable url;
推流 CDN 地址。
@property (copy, nonatomic) NSString * _Nullable roomId;
推流房间 ID。
@property (copy, nonatomic) NSString * _Nullable userId;
推流用户 ID。
+ (instancetype _Nonnull)defaultTranscoding;
获取默认合流参数。
@interface ByteRTCUserInfo : NSObject
用户信息。
| 类型 | 名称 |
|---|---|
| NSString* | userId |
| NSString* | extraInfo |
@property (copy, nonatomic) NSString *_Nonnull userId;
用户 ID。该字符串符合正则表达式:[a-zA-Z0-9_@\-]{1,128}。
@property (copy, nonatomic) NSString *_Nonnull extraInfo;
用户需要透传的额外的信息,字符长度限制为 200 字节。会在 rtcEngine:onUserJoined:elapsed: 中回调给远端用户。
@interface ByteRTCRoomConfig : NSObject
房间参数配置
| 类型 | 名称 |
|---|---|
| ByteRTCRoomProfile | profile |
| BOOL | isAutoPublish |
| BOOL | isAutoSubscribeAudio |
| BOOL | isAutoSubscribeVideo |
@property(nonatomic) ByteRTCRoomProfile profile;
房间模式,参看 ByteRTCRoomProfile,默认为普通音视频通话模式,进房后不可更改。
@property (assign, nonatomic) BOOL isAutoPublish;
是否自动发布音视频流,默认为自动发布。
若调用 setUserVisibility: 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。
@property (assign, nonatomic) BOOL isAutoSubscribeAudio;
是否自动订阅音频流,默认为自动订阅。
进房后,你可以调用 subscribeUserStream:streamType:mediaType:videoConfig: 修改订阅设置。
@property (assign, nonatomic) BOOL isAutoSubscribeVideo;
是否自动订阅主视频流,默认为自动订阅。
进房后,你可以调用 subscribeUserStream:streamType:mediaType:videoConfig: 修改订阅设置。
屏幕流始终自动订阅,不受该方法影响。
@interface ByteRTCMultiRoomConfig : NSObject
多房间参数配置
| 类型 | 名称 |
|---|---|
| ByteRTCRoomProfile | profile |
| BOOL | isAutoSubscribeAudio |
| BOOL | isAutoSubscribeVideo |
@property(nonatomic) ByteRTCRoomProfile profile;
房间模式,参看 ByteRTCRoomProfile,默认为普通音视频通话模式,进房后不可更改。
@property (assign, nonatomic) BOOL isAutoSubscribeAudio;
是否自动订阅音频流。
进房后,你可以调用 subscribeUserStream:streamType:mediaType:videoConfig: 修改订阅设置。
@property (assign, nonatomic) BOOL isAutoSubscribeVideo;
是否自动订阅主视频流。
进房后,你可以调用 subscribeUserStream:streamType:mediaType:videoConfig: 修改订阅设置。
屏幕流始终自动订阅,不受该方法影响。
@interface ByteRTCSubscribeVideoConfig : NSObject
视频订阅配置信息
| 类型 | 名称 |
|---|---|
| NSInteger | videoIndex |
| NSInteger | priority |
@property (assign, nonatomic) NSInteger videoIndex;
订阅的视频流分辨率下标。
当远端用户通过调用 setVideoEncoderConfig:config: 方法启动发布多路不同分辨率的视频流时,本地用户需通过此参数指定希望订阅的流。
默认值为 0,即订阅第一路流。
如果不想更改之前的设置,可以输入 -1。
@property (assign, nonatomic) NSInteger priority;
远端用户优先级,参看 ByteRTCRemoteUserPriority,默认值为 0。
@interface ByteRTCRoomStats : NSObject
房间通话统计数据,统计周期为 2s 。
用户进房成功后,SDK 会周期性地通过 rtcEngine:onRoomStats:
通知用户当前房间内的汇总统计信息。此数据结构即为回调给用户的参数类型。
| 类型 | 名称 |
|---|---|
| NSInteger | duration |
| NSInteger | txBytes |
| NSInteger | rxBytes |
| NSInteger | txAudioKBitrate |
| NSInteger | rxAudioKBitrate |
| NSInteger | txVideoKBitrate |
| NSInteger | rxVideoKBitrate |
| NSInteger | userCount |
| float | rxLostrate |
| float | txLostrate |
| NSInteger | rtt |
| NSInteger | txJitter |
| NSInteger | rxJitter |
@property (assign, nonatomic) NSInteger duration;
用户进房开始通话后的总时长,单位为 s ,累计值
@property (assign, nonatomic) NSInteger txBytes;
本地用户的总发送字节数 (bytes),累计值
@property (assign, nonatomic) NSInteger rxBytes;
本地用户的总接收字节数 (bytes),累计值
@property (assign, nonatomic) NSInteger txAudioKBitrate;
本地用户的音频发送码率 (kbps),瞬时值
@property (assign, nonatomic) NSInteger rxAudioKBitrate;
本地用户的音频接收码率 (kbps),瞬时值
@property (assign, nonatomic) NSInteger txVideoKBitrate;
本地用户的视频发送码率 (kbps),瞬时值
@property (assign, nonatomic) NSInteger rxVideoKBitrate;
本地用户的视频接收码率 (kbps),瞬时值
@property (assign, nonatomic) NSInteger userCount;
当前房间内的用户人数,包括本地用户自身
@property (assign, nonatomic) float rxLostrate;
App 现在的下行丢包率
@property (assign, nonatomic) float txLostrate;
App 现在的上行丢包率
@property (assign, nonatomic) NSInteger rtt;
客户端到服务端的往返时延
@property (assign, nonatomic) NSInteger txJitter;
系统上行网络抖动(ms)
@property (assign, nonatomic) NSInteger rxJitter;
系统下行网络抖动(ms)
@interface ByteRTCSysStats : NSObject
App 使用的 cpu 和 memory 信息
信息由 SDK 周期性(2s)地通过 rtcEngine:reportSysStats: 回调事件通知给用户。
| 类型 | 名称 |
|---|---|
| unsigned | cpu_cores |
| double | cpu_app_usage |
| double | cpu_total_usage |
| double | memory_usage |
| unsigned | full_memory |
| unsigned | total_memory_usage |
| unsigned | free_memory |
| double | memory_ratio |
| double | total_memory_ratio |
@property (assign, nonatomic) unsigned int cpu_cores;
当前系统 cpu 核数
@property (assign, nonatomic) double cpu_app_usage;
当前应用的 CPU 使用率,取值范围为 [0, 1]。
@property (assign, nonatomic) double cpu_total_usage;
当前系统的 CPU 使用率,取值范围为 [0, 1]。
@property (assign, nonatomic) double memory_usage;
当前App的内存使用(单位 MB)
@property (assign, nonatomic) unsigned long long full_memory;
全量内存(单位字节)
@property (assign, nonatomic) unsigned long long total_memory_usage;
系统已使用内存(单位字节)
@property (assign, nonatomic) unsigned long long free_memory;
空闲可分配内存(单位字节)
@property (assign, nonatomic) double memory_ratio;
当前应用的内存使用率(单位 %)
@property (assign, nonatomic) double total_memory_ratio;
系统内存使用率(单位 %)
@interface ByteRTCLocalVideoStats : NSObject
本地视频流统计信息,统计周期为 2s 。
本地用户发布视频流成功后,SDK 会周期性地通过 rtcEngine:onLocalStreamStats:
通知本地用户发布的视频流在此次统计周期内的发送状况。此数据结构即为回调给本地用户的参数类型。
| 类型 | 名称 |
|---|---|
| float | sentKBitrate |
| NSInteger | inputFrameRate |
| NSInteger | sentFrameRate |
| NSInteger | encoderOutputFrameRate |
| NSInteger | rendererOutputFrameRate |
| NSInteger | sentTargetKBitrate |
| NSInteger | sentTargetFrameRate |
| NSInteger | statsInterval |
| float | videoLossRate |
| NSInteger | rtt |
| NSInteger | encodedBitrate |
| NSInteger | encodedFrameWidth |
| NSInteger | encodedFrameHeight |
| NSInteger | encodedFrameCount |
| ByteRTCVideoCodecType | codecType |
| BOOL | isScreen |
| NSInteger | jitter |
@property (assign, nonatomic) float sentKBitrate;
发送的码率。此次统计周期内的视频发送码率,单位为 kbps 。
@property (assign, nonatomic) NSInteger inputFrameRate;
采集帧率。此次统计周期内的视频采集帧率,单位为 fps 。
@property (assign, nonatomic) NSInteger sentFrameRate;
发送帧率。此次统计周期内的视频发送帧率,单位为 fps 。
@property (assign, nonatomic) NSInteger encoderOutputFrameRate;
编码器输出帧率。当前编码器在此次统计周期内的输出帧率,单位为 fps 。
@property (assign, nonatomic) NSInteger rendererOutputFrameRate;
本地渲染帧率。此次统计周期内的本地视频渲染帧率,单位为 fps 。
@property (assign, nonatomic) NSInteger sentTargetKBitrate;
目标发送码率。此次统计周期内的视频目标发送码率,单位为 kbps 。
@property (assign, nonatomic) NSInteger sentTargetFrameRate;
目标发送帧率。当前编码器在此次统计周期内的目标发送帧率,单位为 fps 。
@property (assign, nonatomic) NSInteger statsInterval;
统计间隔,单位为 ms 。
注意: 此字段用于设置回调的统计周期,默认设置为 2s 。 此字段用于设置回调的统计周期,默认设置为 2s 。
@property (assign, nonatomic) float videoLossRate;
视频丢包率。统计周期内的视频上行丢包率,取值范围为 [0, 1] 。
@property (assign, nonatomic) NSInteger rtt;
往返时延。单位为 ms 。
@property(assign, nonatomic) NSInteger encodedBitrate;
视频编码码率。此次统计周期内的视频编码码率,单位为 kbps 。
@property(assign, nonatomic) NSInteger encodedFrameWidth;
视频编码宽度,单位为 px 。
@property(assign, nonatomic) NSInteger encodedFrameHeight;
视频编码高度,单位为 px 。
@property(assign, nonatomic) NSInteger encodedFrameCount;
此次统计周期内发送的视频帧总数。
@property(nonatomic) ByteRTCVideoCodecType codecType;
编码类型。参看 ByteRTCVideoCodecType 类型。
@property (assign, nonatomic) BOOL isScreen;
所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。
@property(assign, nonatomic) NSInteger jitter;
视频上行网络抖动,单位为 ms。
@interface ByteRTCRemoteVideoStats : NSObject
远端音频流统计信息,统计周期为 2s 。
本地用户订阅远端音频流成功后,SDK 会周期性地通过 rtcEngine:onRemoteStreamStats:
通知本地用户订阅的远端视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。
| 类型 | 名称 |
|---|---|
| NSInteger | width |
| NSInteger | height |
| float | videoLossRate |
| float | receivedKBitrate |
| NSInteger | receivedFrameRate |
| NSInteger | decoderOutputFrameRate |
| NSInteger | renderOutputFrameRate |
| NSInteger | stallCount |
| NSInteger | stallDuration |
| NSInteger | e2eDelay |
| BOOL | isScreen |
| NSInteger | statsInterval |
| NSInteger | rtt |
| NSInteger | frozenRate |
| NSInteger | videoIndex |
| NSInteger | jitter |
@property (assign, nonatomic) NSInteger width;
远端视频宽度。
@property (assign, nonatomic) NSInteger height;
远端视频高度。
@property (assign, nonatomic) float videoLossRate;
远端视频丢包率。统计周期内的视频下行丢包率,取值范围为 [0, 1] 。
@property (assign, nonatomic) float receivedKBitrate;
接收码率。统计周期内的视频接收码率,单位为 kbps 。
@property (assign, nonatomic) NSInteger receivedFrameRate;
远端视频接收帧率。
@property (assign, nonatomic) NSInteger decoderOutputFrameRate;
远端视频解码输出帧率。
@property (assign, nonatomic) NSInteger renderOutputFrameRate;
远端视频渲染输出帧率。
@property (assign, nonatomic) NSInteger stallCount;
远端视频卡顿次数。
@property (assign, nonatomic) NSInteger stallDuration;
远端视频卡顿时长,单位为 ms 。
@property (assign, nonatomic) NSInteger e2eDelay;
用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。
@property (assign, nonatomic) BOOL isScreen;
远端视频流是否是屏幕共享流。你可以知道当前数据来自主流还是屏幕流。
@property (assign, nonatomic) NSInteger statsInterval;
统计间隔,此次统计周期的间隔,单位为 ms 。
注意: 此字段用于设置回调的统计周期,目前设置为 2s 。 此字段用于设置回调的统计周期,目前设置为 2s 。
@property (assign, nonatomic) NSInteger rtt;
往返时延。单位为 ms 。
@property(assign, nonatomic) NSInteger frozenRate;
远端用户在进房后发生视频卡顿的累计时长占视频总有效时长的百分比(%)。视频有效时长是指远端用户进房发布视频流后,除停止发送视频流和禁用视频模块之外的视频时长。
@property (assign, nonatomic) NSInteger videoIndex;
SDK 订阅的远端视频流的分辨率下标。
@property(assign, nonatomic) NSInteger jitter;
视频下行网络抖动,单位为 ms。
@interface ByteRTCLocalAudioStats : NSObject
本地音频流统计信息,统计周期为 2s 。
本地用户发布音频流成功后,SDK 会周期性地通过 rtcEngine:onLocalStreamStats:
通知本地用户发布的音频流在此次统计周期内的发送状况。此数据结构即为回调给本地用户的参数类型。
| 类型 | 名称 |
|---|---|
| float | audioLossRate |
| float | sentKBitrate |
| NSInteger | recordSampleRate |
| NSInteger | statsInterval |
| NSInteger | rtt |
| NSInteger | numChannels |
| NSInteger | sentSampleRate |
| NSInteger | jitter |
@property (assign, nonatomic) float audioLossRate;
音频丢包率。此次统计周期内的音频上行丢包率,取值范围为 [0, 1] 。
@property (assign, nonatomic) float sentKBitrate;
发送的码率。此次统计周期内的音频发送码率,单位为 kbps 。
@property (assign, nonatomic) NSInteger recordSampleRate;
采集采样率。此次统计周期内的音频采集采样率信息,单位为 Hz 。
@property (assign, nonatomic) NSInteger statsInterval;
统计间隔。此次统计周期的间隔,单位为 ms 。
注意: 此字段用于设置回调的统计周期,默认设置为 2s 。 此字段用于设置回调的统计周期,默认设置为 2s 。
@property (assign, nonatomic) NSInteger rtt;
往返时延。单位为 ms 。
@property(assign, nonatomic) NSInteger numChannels;
音频声道数。
@property(assign, nonatomic) NSInteger sentSampleRate;
音频发送采样率。此次统计周期内的音频发送采样率信息,单位为 Hz 。
@property(assign, nonatomic) NSInteger jitter;
音频上行网络抖动,单位为 ms。
@interface ByteRTCRemoteAudioStats : NSObject
远端音频流统计信息,统计周期为 2s 。
本地用户订阅远端音频流成功后,SDK 会周期性地通过 rtcEngine:onRemoteStreamStats:
通知本地用户订阅的音频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。
| 类型 | 名称 |
|---|---|
| float | audioLossRate |
| float | receivedKBitrate |
| NSInteger | stallCount |
| NSInteger | stallDuration |
| NSInteger | playoutSampleRate |
| NSInteger | e2eDelay |
| NSInteger | statsInterval |
| NSInteger | rtt |
| NSInteger | total_rtt |
| NSInteger | quality |
| NSInteger | jitterBufferDelay |
| NSInteger | numChannels |
| NSInteger | receivedSampleRate |
| NSInteger | frozenRate |
| NSInteger | concealedSamples |
| NSInteger | concealmentEvent |
| NSInteger | decSampleRate |
| NSInteger | decDuration |
| NSInteger | jitter |
@property (assign, nonatomic) float audioLossRate;
音频丢包率。统计周期内的音频下行丢包率,取值范围为 [0, 1] 。
@property (assign, nonatomic) float receivedKBitrate;
接收码率。统计周期内的音频接收码率,单位为 kbps 。
@property (assign, nonatomic) NSInteger stallCount;
音频卡顿次数。统计周期内的卡顿次数。
@property (assign, nonatomic) NSInteger stallDuration;
音频卡顿时长。统计周期内的卡顿时长,单位为 ms 。
@property (assign, nonatomic) NSInteger playoutSampleRate;
播放采样率。统计周期内的音频播放采样率信息,单位为 Hz 。
@property (assign, nonatomic) NSInteger e2eDelay;
用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。
@property (assign, nonatomic) NSInteger statsInterval;
统计间隔。此次统计周期的间隔,单位为 ms 。
@property (assign, nonatomic) NSInteger rtt;
客户端到服务端数据传输的往返时延,单位为 ms。
@property (assign, nonatomic) NSInteger total_rtt;
发送端——服务端——接收端全链路数据传输往返时延。单位为 ms 。
@property(assign, nonatomic) NSInteger quality;
远端用户发送的音频流质量。值含义参考 ByteRTCNetworkQuality 。
@property(assign, nonatomic) NSInteger jitterBufferDelay;
因引入 jitter buffer 机制导致的延时。单位为 ms 。
@property(assign, nonatomic) NSInteger numChannels;
音频声道数。
@property(assign, nonatomic) NSInteger receivedSampleRate;
音频接收采样率。统计周期内接收到的远端音频采样率信息,单位为 Hz 。
@property(assign, nonatomic) NSInteger frozenRate;
远端用户在加入房间后发生音频卡顿的累计时长占音频总有效时长的百分比。音频有效时长是指远端用户进房发布音频流后,除停止发送音频流和禁用音频模块之外的音频时长。
@property(assign, nonatomic) NSInteger concealedSamples;
音频 PLC 样点总个数。
@property(assign, nonatomic) NSInteger concealmentEvent;
音频丢包补偿(PLC) 累计次数。
@property(assign, nonatomic) NSInteger decSampleRate;
音频解码采样率。统计周期内的音频解码采样率信息,单位为 Hz 。
@property(assign, nonatomic) NSInteger decDuration;
解码时长。对此次统计周期内接收的远端音频流进行解码的总耗时,单位为 s 。
@property(assign, nonatomic) NSInteger jitter;
视频下行网络抖动,单位为 ms。
@interface ByteRTCAudioVolumeInfo : NSObject
音频流来源的用户 ID, 及对应的音量。
| 类型 | 名称 |
|---|---|
| NSString* | uid |
| NSUInteger | volume |
@property (copy, nonatomic) NSString * _Nonnull uid;
音频流来源的用户 ID
@property (assign, nonatomic) NSUInteger volume;
音量,取值范围为:[0,255]
@interface ByteRTCSourceWantedData : NSObject
性能回退相关数据
| 类型 | 名称 |
|---|---|
| NSInteger | width |
| NSInteger | height |
| NSInteger | frameRate |
@property (nonatomic, assign) NSInteger width;
推荐视频输入宽
@property (nonatomic, assign) NSInteger height;
推荐视频输入高
@property (nonatomic, assign) NSInteger frameRate;
推荐视频输入帧率
@interface ByteRTCRemoteStreamSwitchEvent : NSObject
流切换信息。本地用户订阅的远端流触发回退策略时的流切换信息。
| 类型 | 名称 |
|---|---|
| NSString* | uid |
| BOOL | isScreen |
| NSInteger | beforeVideoIndex |
| NSInteger | afterVideoIndex |
| BOOL | beforeVideoEnabled |
| BOOL | afterVideoEnabled |
| ByteRTCFallbackOrRecoverReason | reason |
@property (nonatomic, copy) NSString * _Nonnull uid;
订阅的音视频流的发布者的用户 ID。
@property (nonatomic, assign) BOOL isScreen;
流是否是屏幕流
@property (nonatomic, assign) NSInteger beforeVideoIndex;
流切换前订阅视频流的分辨率对应的索引
@property (nonatomic, assign) NSInteger afterVideoIndex;
流切换后订阅视频流的分辨率对应的索引
@property (nonatomic, assign) BOOL beforeVideoEnabled;
流切换前是否有视频流
@property (nonatomic, assign) BOOL afterVideoEnabled;
流切换后是否有视频流
@property (nonatomic, assign) ByteRTCFallbackOrRecoverReason reason;
流切换原因,详见 ByteRTCFallbackOrRecoverReason。
@protocol ByteRTCVideoSinkDelegate <NSObject>
自定义视频渲染器
| 返回 | 名称 |
|---|---|
| void | renderPixelBuffer:rotation:extendedData: |
- (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(ByteRTCVideoRotation)rotation extendedData:(NSData * _Nullable)extendedData;
输出视频的 PixelBuffer
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pixelBuffer | CVPixelBufferRef | 视频的 PixelBuffer |
| rotation | ByteRTCVideoRotation | 视频旋转角度,参看 ByteRTCVideoRotation |
| extendedData | NSData* | 视频解码后获得的附加数据 |
@interface ByteRTCVideoPreprocessorConfig : NSObject
视频处理配置参数
| 类型 | 名称 |
|---|---|
| ByteRTCVideoPixelFormat | required_pixel_format |
@property (nonatomic, assign) ByteRTCVideoPixelFormat required_pixel_format;
视频帧的像素格式,参看 ByteRTCVideoPixelFormat。
@interface ByteRTCStreamEx : NSObject <ByteRTCStream>
流信息
| 类型 | 名称 |
|---|---|
| NSString* | userId |
| BOOL | isScreen |
| BOOL | hasVideo |
| BOOL | hasAudio |
| NSArray |
videoStreamDescriptions |
@property (nonatomic, copy, nullable) NSString *userId;
用户ID
@property (nonatomic, assign) BOOL isScreen;
流是否为共享屏幕流。
@property (nonatomic, assign) BOOL hasVideo;
该路流中是否包含视频
@property (nonatomic, assign) BOOL hasAudio;
该路流中是否包含音频
@property (nonatomic, copy, nullable) NSArray<ByteRTCVideoSolution *> *videoStreamDescriptions;
视频流的分辨率信息,详见 ByteRTCVideoSolution 类。 用户可以通过调用 setVideoEncoderConfig:config: 方法在一路流中发布多个不同的视频分辨率。此参数即为流中所有分辨率的相关信息。
@interface ByteRTCScreenCaptureParam : NSObject
屏幕采集设置参数
| 类型 | 名称 |
|---|---|
| NSInteger | width |
| NSInteger | height |
| NSInteger | frameRate |
| NSInteger | bitrate |
| BOOL | captureMouseCursor |
@property (nonatomic, assign) NSInteger width;
屏幕采集宽度
@property (nonatomic, assign) NSInteger height;
屏幕采集高度
@property (nonatomic, assign) NSInteger frameRate;
屏幕采集帧率,单位 fps
@property (nonatomic, assign) NSInteger bitrate;
发送屏幕采集码率,单位 kbps
@property (nonatomic, assign) BOOL captureMouseCursor;
是否采集鼠标
@interface ByteRTCScreenParam : NSObject
屏幕采集设置参数
| 类型 | 名称 |
|---|---|
| NSInteger | frameRate |
| NSInteger | bitrate |
@property (nonatomic, assign) NSInteger frameRate;
编码帧率,单位为 fps
@property (nonatomic, assign) NSInteger bitrate;
编码码率,小于 0 时 SDK 会根据高宽自适应码率, 单位 kbps
@interface ByteRTCUser : NSObject
用户信息
| 类型 | 名称 |
|---|---|
| NSString* | userId |
| NSString* | metaData |
@property (nonatomic, copy, nullable) NSString *userId;
用户 ID
@property (nonatomic, copy, nullable) NSString *metaData;
元信息
@interface ByteRTCLocalStreamStats : NSObject
本地音/视频流统计信息以及网络状况,统计周期为 2s 。
本地用户发布音/视频流成功后,SDK 会周期性地通过 rtcEngine:onLocalStreamStats:
通知本地用户发布的音/视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。
| 类型 | 名称 |
|---|---|
| ByteRTCLocalAudioStats* | audio_stats |
| ByteRTCLocalVideoStats* | video_stats |
| ByteRTCNetworkQuality | tx_quality |
| ByteRTCNetworkQuality | rx_quality |
| BOOL | is_screen |
@property (strong, nonatomic) ByteRTCLocalAudioStats *_Nonnull audio_stats;
本地设备发送音频流的统计信息,详见 ByteRTCLocalAudioStats
@property (strong, nonatomic) ByteRTCLocalVideoStats *_Nonnull video_stats;
本地设备发送视频流的统计信息,详见 ByteRTCLocalVideoStats
@property (assign, nonatomic) ByteRTCNetworkQuality tx_quality;
所属用户的媒体流上行网络质量,详见 ByteRTCNetworkQuality
@property (assign, nonatomic) ByteRTCNetworkQuality rx_quality;
所属用户的媒体流下行网络质量,详见 ByteRTCNetworkQuality
@property (nonatomic, assign) BOOL is_screen;
所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。
@interface ByteRTCRemoteStreamStats : NSObject
用户订阅的远端音/视频流统计信息以及网络状况,统计周期为 2s 。
订阅远端用户发布音/视频流成功后,SDK 会周期性地通过 rtcEngine:onRemoteStreamStats:
通知本地用户订阅的远端音/视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。
| 类型 | 名称 |
|---|---|
| NSString* | uid |
| ByteRTCRemoteAudioStats* | audio_stats |
| ByteRTCRemoteVideoStats* | video_stats |
| ByteRTCNetworkQuality | tx_quality |
| ByteRTCNetworkQuality | rx_quality |
| BOOL | is_screen |
@property (copy, nonatomic) NSString *_Nonnull uid;
用户 ID 。音频来源的用户 ID 。
@property (strong, nonatomic) ByteRTCRemoteAudioStats *_Nonnull audio_stats;
远端音频流的统计信息,详见 ByteRTCRemoteAudioStats
@property (strong, nonatomic) ByteRTCRemoteVideoStats *_Nonnull video_stats;
远端视频流的统计信息,详见 ByteRTCRemoteVideoStats
@property (assign, nonatomic) ByteRTCNetworkQuality tx_quality;
所属用户的媒体流上行网络质量,详见 ByteRTCNetworkQuality
@property (assign, nonatomic) ByteRTCNetworkQuality rx_quality;
所属用户的媒体流下行网络质量,详见 ByteRTCNetworkQuality
@property (nonatomic, assign) BOOL is_screen;
所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。
typedef NS_ENUM(NSInteger, ByteRTCMuteState)
音视频流的发送/播放状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCMuteStateOff | 0 | 发送 |
| ByteRTCMuteStateOn | 1 | 停止发送 |
typedef NS_ENUM(NSInteger, ByteRTCSubscribeMediaType)
订阅媒体的类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCSubscribeMediaTypeNone | 0 | 既不订阅音频,也不订阅视频 |
| ByteRTCSubscribeMediaTypeAudioOnly | 1 | 只订阅音频,不订阅视频 |
| ByteRTCSubscribeMediaTypeVideoOnly | 2 | 只订阅视频,不订阅音频 |
| ByteRTCSubscribeMediaTypeAudioAndVideo | 3 | 同时订阅音频和视频 |
typedef NS_ENUM(NSInteger, ByteRTCPauseResumControlMediaType)
暂停/恢复接收远端的媒体流类型。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCControlMediaTypeAudio | 0 | 只控制音频,不影响视频 |
| ByteRtcControlMediaTypeVideo | 1 | 只控制视频,不影响音频 |
| ByteRtcControlMediaTypeAudioAndVideo | 2 | 同时控制音频和视频 |
typedef NS_ENUM(NSInteger, ByteRTCStreamIndex)
流属性
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCStreamIndexMain | 0 | 主流。包括: + 由摄像头/麦克风通过内部采集机制,采集到的视频/音频; + 通过自定义采集,采集到的视频/音频。 |
| ByteRTCStreamIndexScreen | 1 | 屏幕流。屏幕共享时共享的视频流,或来自声卡的本地播放音频流。 |
typedef NS_ENUM(NSInteger, ByteRTCVideoSourceType)
视频输入源类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoSourceTypeExternal | 0 | 自定义采集视频源 |
| ByteRTCVideoSourceTypeInternal | 1 | 内部采集视频源 |
| ByteRTCVideoSourceTypeEncodedManualSimulcast | 2 | 自定义编码视频源。 SDK 不会自动生成多路流,你需要自行生成并推送多路流 |
| ByteRTCVideoSourceTypeEncodedAutoSimulcast | 3 | 自定义编码视频源。 你仅需推送分辨率最大的一路编码后视频流,SDK 将自动转码生成多路小流 |
typedef NS_ENUM(NSInteger, ByteRTCVideoDecoderConfig)
视频解码方式
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVideoDecoderConfigRaw | 0 | 开启 SDK 内部解码,只回调解码后的数据 |
| ByteRTCVideoDecoderConfigEncode | 1 | 开启自定义解码,只回调解码前数据 |
| ByteRTCVideoDecoderConfigBoth | 2 | 开启 SDK 内部解码,同时回调解码前和解码后的数据 |
@interface ByteRTCRemoteStreamKey : NSObject
用户信息
| 类型 | 名称 |
|---|---|
| NSString* | userId |
| NSString* | roomId |
| ByteRTCStreamIndex | streamIndex |
@property (nonatomic, copy, nullable) NSString *userId;
用户 ID
@property (nonatomic, copy, nullable) NSString *roomId;
房间 ID
@property (nonatomic, assign) ByteRTCStreamIndex streamIndex;
流属性,包括主流、屏幕流。参看 ByteRTCStreamIndex
typedef NS_ENUM(NSInteger, ByteRTCVirtualBackgroundSourceType)
虚拟背景类型。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCVirtualBackgroundSourceTypeColor | 0 | 使用纯色背景替换视频原有背景。 |
| ByteRTCVirtualBackgroundSourceTypeImage | 1 | 使用自定义图片背景替换视频原有背景。 |
@interface ByteRTCVirtualBackgroundSource: NSObject
虚拟背景对象。
| 类型 | 名称 |
|---|---|
| ByteRTCVirtualBackgroundSourceType | sourceType |
| int | sourceColor |
| NSString* | sourcePath |
@property (nonatomic, assign) ByteRTCVirtualBackgroundSourceType sourceType;
虚拟背景类型,详见 ByteRTCVirtualBackgroundSourceType 。
@property int sourceColor;
纯色背景使用的颜色。
格式为 0xAARRGGBB 。
@property (nonatomic) NSString* sourcePath;
自定义图片背景使用的图片的绝对路径。
注意:
分辨率超过 1080P 时,图片会被等比缩放。背景图片和视频分辨率不一致时,图片会被裁剪缩放。
支持的格式为 jpg、jpeg、和 png。
typedef NS_ENUM(NSInteger, ByteRTCAudioSampleRate)
音频采样率,单位为 Hz。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioSampleRateAuto | -1 | 默认设置。 |
| ByteRTCAudioSampleRate8000 | 8000 | 8000 Hz |
| ByteRTCAudioSampleRate16000 | 16000 | 16000 Hz |
| ByteRTCAudioSampleRate32000 | 32000 | 32000 Hz |
| ByteRTCAudioSampleRate44100 | 44100 | 44100 Hz |
| ByteRTCAudioSampleRate48000 | 48000 | 48000 Hz |
typedef NS_ENUM(NSInteger, ByteRTCAudioChannel)
音频声道。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioChannelAuto | -1 | 默认设置。 |
| ByteRTCAudioChannelMono | 1 | 单声道 |
| ByteRTCAudioChannelStereo | 2 | 双声道 |
typedef NS_ENUM(NSInteger, ByteRTCAudioPlaybackDevice)
音频播放设备
音频设备变化时 SDK 通过 rtcEngine:onAudioPlaybackDeviceChanged: 回调当前音频播放设备。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioPlaybackDeviceSpeakerphone | 1 | 扬声器 |
| ByteRTCAudioPlaybackDeviceEarpiece | 2 | 听筒 |
| ByteRTCAudioPlaybackDeviceHeadset | 3 | 有线耳机 |
| ByteRTCAudioPlaybackDeviceHeadsetBluetooth | 4 | 蓝牙耳机 |
| ByteRTCAudioPlaybackDeviceHeadsetUSB | 5 | USB设备 |
@interface ByteRTCAudioFormat : NSObject
音频参数格式
| 类型 | 名称 |
|---|---|
| ByteRTCAudioSampleRate | sampleRate |
| ByteRTCAudioChannel | channel |
@property (nonatomic, assign) ByteRTCAudioSampleRate sampleRate;
音频采样率,详见 ByteRTCAudioSampleRate
@property (nonatomic, assign) ByteRTCAudioChannel channel;
音频声道,详见 ByteRTCAudioChannel
@interface ByteRTCAudioFrame : NSObject
PCM 音频帧
| 类型 | 名称 |
|---|---|
| NSData* | buffer |
| int | samples |
| ByteRTCAudioChannel | channel |
| ByteRTCAudioSampleRate | sampleRate |
@property (strong, nonatomic) NSData * _Nonnull buffer;
PCM 数据
@property (assign, nonatomic) int samples;
采样点个数
@property (assign, nonatomic) ByteRTCAudioChannel channel;
音频声道,参看 ByteRTCAudioChannel。
@property (assign, nonatomic) ByteRTCAudioSampleRate sampleRate;
采样率,参看 ByteRTCAudioSampleRate。
@interface ByteRTCVideoFrameInfo : NSObject
视频帧基础信息
| 类型 | 名称 |
|---|---|
| NSInteger | width |
| NSInteger | height |
| ByteRTCVideoRotation | rotation |
@property (nonatomic, assign) NSInteger width;
视频帧的宽度(像素)
@property (nonatomic, assign) NSInteger height;
视频帧的高度(像素)
@property (nonatomic, assign) ByteRTCVideoRotation rotation;
视频帧顺时针旋转角度。参看 ByteRTCVideoRotation。
typedef NS_ENUM(NSInteger, ByteRTCCameraID)
移动端摄像头
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCCameraIDFront | 0 | 前置摄像头 |
| ByteRTCCameraIDBack | 1 | 后置摄像头 |
typedef NS_ENUM(NSInteger, ByteRTCASRAuthorizationType)
语音识别服务鉴权方式,详情请咨询语音识别服务服务相关同学
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCASRAuthorizationTypeToken | 0 | 使用 token 不设置加密形式。 |
| ByteRTCASRAuthorizationTypeSignature | 1 | 带有 token 额外使用 signature 加密,此种加密形式需要额外传递 secret token 。 |
typedef NS_ENUM(NSInteger, ByteRTCASRErrorCode)
语音识别服务错误码。
除网络原因导致的错误,语音识别服务内部会自行重试之外,其他错误都会停止服务,此时建议再次调用 startASR:handler: 重启语音识别功能。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCASRErrorNetworkInterrupted | -1 | 网络连接中断,服务不可用,内部会进行重连 |
| ByteRTCASRErrorAlreadyStarted | -2 | 用户已经调用过 startASR:handler:。 开启语音识别服务后,你需要先调用 stopASR 停止语音识别服务,才能二次调用 startASR:handler: 再次开启服务。 |
| ByteRTCASRErrorTokenEmpty | -3 | 语音识别服务所需 token 为空 |
| ByteRTCErrorSignatureKeyEmpty | -4 | Signature 鉴权模式下 secretKey 为空 |
| ByteRTCASRErrorUserIdNull | -5 | 用户 ID 为空 |
| ByteRTCASRErrorAPPIDNull | -6 | 应用 ID 为空 |
| ByteRTCASRErrorClusterNull | -7 | 语音识别服务 cluster 为空 |
| ByteRTCASRErrorOperationDenied | -8 | 语音识别服务连接失败,该版本没有语音识别功能,请联系 RTC 技术支持。 |
@interface ByteRTCASRConfig : NSObject
使用自动语音识别服务所需校验信息
| 类型 | 名称 |
|---|---|
| NSString* | appId |
| NSString* | userId |
| NSString* | accessToken |
| NSString* | secretKey |
| NSString* | cluster |
| ByteRTCASRAuthorizationType | authorizationType |
@property (copy, nonatomic) NSString *_Nonnull appId;
应用 ID
@property (copy, nonatomic) NSString *_Nonnull userId;
用户 ID
@property (copy, nonatomic) NSString *_Nonnull accessToken;
访问令牌
@property (copy, nonatomic) NSString *_Nonnull secretKey;
私钥。Signature 鉴权模式下不能为空,token 鉴权模式下为空。参看关于鉴权
@property (copy, nonatomic) NSString *_Nonnull cluster;
场景信息,参看业务集群
@property (assign, nonatomic) ByteRTCASRAuthorizationType authorizationType;
鉴权模式,参看 ByteRTCASRAuthorizationType
typedef NS_ENUM(NSInteger, ByteRTCRecordingState)
本地录制的状态
| 类型 | 值 | 说明 |
|---|---|---|
| RecordingStateError | 0 | 录制异常 |
| RecordingStateProcessing | 1 | 录制进行中 |
| RecordingStateSuccess | 2 | 录制文件保存成功,调用 stopFileRecording: 结束录制之后才会收到该状态码。 |
typedef NS_ENUM(NSInteger, ByteRTCRecordingErrorCode)
本地录制错误码
| 类型 | 值 | 说明 |
|---|---|---|
| RecordingErrorCodeOk | 0 | 录制正常 |
| RecordingErrorCodeNoPermission | -1 | 没有文件写权限 |
| RecordingErrorCodeNotSupport | -2 | 当前版本 SDK 不支持本地录制功能,请联系技术支持人员 |
| RecordingErrorCodeOther | -3 | 其他异常 |
typedef NS_ENUM(NSInteger, ByteRTCRecordingFileType)
本地录制文件的存储格式
| 类型 | 值 | 说明 |
|---|---|---|
| RecordingFileTypeAAC | 0 | aac 格式文件 |
| RecordingFileTypeMP4 | 1 | mp4 格式文件 |
typedef NS_ENUM(NSInteger, ByteRTCRecordingType)
本地录制的媒体类型
| 类型 | 值 | 说明 |
|---|---|---|
| RecordAudioOnly | 0 | 只录制音频 |
| RecordVideoOnly | 1 | 只录制视频 |
| RecordVideoAndAudio | 2 | 同时录制音频和视频 |
@interface ByteRTCRecordingProgress : NSObject
本地录制进度
| 类型 | 名称 |
|---|---|
| unsigned | duration |
| unsigned | fileSize |
@property (assign, nonatomic) unsigned long long duration;
当前文件的累计录制时长,单位:毫秒
@property (assign, nonatomic) unsigned long long fileSize;
当前录制文件的大小,单位:byte
@interface ByteRTCRecordingInfo : NSObject
本地录制的详细信息
| 类型 | 名称 |
|---|---|
| NSString* | filePath |
| ByteRTCVideoCodecType | codecType |
| NSInteger | width |
| NSInteger | height |
@property (strong, nonatomic) NSString* _Nullable filePath;
录制文件的绝对路径,包含文件名和文件后缀
@property (assign, nonatomic) ByteRTCVideoCodecType codecType;
录制文件的视频编码类型,参看 ByteRTCVideoCodecType
@property (nonatomic, assign) NSInteger width;
录制视频的宽,单位:像素。纯音频录制请忽略该字段
@property (nonatomic, assign) NSInteger height;
录制视频的高,单位:像素。纯音频录制请忽略该字段
@interface ByteRTCRecordingConfig : NSObject
本地录制参数配置
| 类型 | 名称 |
|---|---|
| NSString* | dirPath |
| ByteRTCRecordingFileType | recordingFileType |
| ByteRTCRecordingType | recordingType |
@property (strong, nonatomic) NSString* _Nullable dirPath;
录制文件保存的绝对路径。你需要指定一个有读写权限的合法路径。
@property (assign, nonatomic) ByteRTCRecordingFileType recordingFileType;
录制存储文件格式,参看 ByteRTCRecordingFileType
@property (assign, nonatomic) ByteRTCRecordingType recordingType;
录制媒体类型,参看 ByteRTCRecordingType
typedef NS_ENUM(NSInteger, ByteRTCAudioMixingType)
混音播放类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioMixingTypePlayout | 0 | 仅本地播放 |
| ByteRTCAudioMixingTypePublish | 1 | 仅发送到远端 |
| ByteRTCAudioMixingTypePlayoutAndPublish | 2 | 在本地播放并发送到远端 |
typedef NS_ENUM(NSInteger, ByteRTCAudioMixingDualMonoMode)
混音播放声道类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioMixingDualMonoModeAuto | 0 | 和音频文件一致 |
| ByteRTCAudioMixingDualMonoModeL | 1 | 只能听到音频文件中左声道的音频 |
| ByteRTCAudioMixingDualMonoModeR | 2 | 只能听到音频文件中右声道的音频 |
| ByteRTCAudioMixingDualMonoModeMix | 3 | 能同时听到音频文件中左右声道的音频 |
typedef NS_ENUM(NSInteger, ByteRTCAudioMixingState)
音频混音文件播放状态。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioMixingStatePreloaded | 0 | 混音已加载 |
| ByteRTCAudioMixingStatePlaying | 0 | 混音正在播放 |
| ByteRTCAudioMixingStatePaused | 1 | 混音暂停 |
| ByteRTCAudioMixingStateStopped | 2 | 混音停止 |
| ByteRTCAudioMixingStateFailed | 3 | 混音播放失败 |
| ByteRTCAudioMixingStateFinished | 4 | 混音播放结束 |
| ByteRTCAudioMixingStatePCMEnabled | 5 | 准备PCM混音 |
| ByteRTCAudioMixingStatePCMDisabled | 6 | PCM混音播放结束 |
typedef NS_ENUM(NSInteger, ByteRTCAudioMixingError)
音频混音文件播放错误码。
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioMixingErrorOk | 0 | 混音错误码,正常 |
| ByteRTCAudioMixingErrorPreloadFailed | 0 | 预加载失败,找不到混音文件或者文件长度超出 20s |
| ByteRTCAudioMixingErrorStartFailed | 1 | 混音开启失败,找不到混音文件或者混音文件打开失败 |
| ByteRTCAudioMixingErrorIdNotFound | 2 | 混音 ID 异常 |
| ByteRTCAudioMixingErrorSetPositionFailed | 3 | 设置混音文件的播放位置出错 |
| ByteRTCAudioMixingErrorInValidVolume | 4 | 音量参数不合法,仅支持设置的音量值为[0 400] |
| ByteRTCAudioMixingErrorIdTypeNotMatch | 5 | 混音 ID 类型不匹配,当前操作接口不支持该 ID 代表的音频流类型 |
| ByteRTCAudioMixingErrorLoadConflict | 6 | 播放的文件与预加载的文件不一致,请先使用 unloadAudioMixing: 卸载文件。 |
| ByteRTCAudioMixingErrorInValidPitch | 7 | 设置混音文件的音调不合法 |
| ByteRTCAudioMixingErrorInValidAudioTrack | 8 | 设置混音文件的音轨不合法 |
typedef NS_ENUM(NSInteger, ByteRTCAudioSourceType)
音频输入源类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCAudioSourceTypeExternal | 0 | 自定义采集音频源 |
| ByteRTCAudioSourceTypeInternal | 0 | RTC SDK 内部采集音频源 |
typedef NS_ENUM(NSInteger, ByteRTCEarMonitorMode)
开启/关闭耳返功能
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCEarMonitorModeOff | 0 | 不开启耳返功能 |
| ByteRTCEarMonitorModeOn | 1 | 开启耳返功能 |
@interface ByteRTCAudioMixingConfig : NSObject
混音配置
| 类型 | 名称 |
|---|---|
| ByteRTCAudioMixingType | type |
| NSInteger | playCount |
| NSInteger | position |
| NSInteger | callbackOnProgressInterval |
@property (assign, nonatomic) ByteRTCAudioMixingType type;
混音播放类型,详见 ByteRTCAudioMixingType
@property (assign, nonatomic) NSInteger playCount;
混音播放次数
注意:
play_count > 1: 播放 play_count 次
play_count <= 0: 无限循环
@property (assign, nonatomic) NSInteger position;
混音时音频文件播放进度条位置,参数为整数,单位为毫秒
@property (assign, nonatomic) NSInteger callbackOnProgressInterval;
设置音频文件播放进度回调的时间间隔,单位毫秒,并按照设置的值触发 rtcEngine:onAudioMixingPlayingProgress:progress: 回调,默认不回调。
@interface ByteRTCAudioPropertiesConfig : NSObject
音频属性信息提示的相关配置
| 类型 | 名称 |
|---|---|
| NSInteger | interval |
| BOOL | enable_spectrum |
| BOOL | enable_vad |
@property (assign, nonatomic) NSInteger interval;
信息提示间隔,单位:ms
注意:
0 && <=100: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms
100: 开启信息提示,并将信息提示间隔设置为此值
<= 0: 关闭信息提示
0 && <=100: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms
100: 开启信息提示,并将信息提示间隔设置为此值
@property (assign, nonatomic) BOOL enable_spectrum;
是否开启音频频谱检测
@property (assign, nonatomic) BOOL enable_vad;
是否开启人声检测 (VAD)
@interface ByteRTCAudioPropertiesInfo : NSObject
音频属性信息
| 类型 | 名称 |
|---|---|
| NSInteger | volume |
| NSInteger | vad |
| NSArray |
spectrum |
@property (assign, nonatomic) NSInteger volume;
音量,取值范围为:[0,255]
@property (assign, nonatomic) NSInteger vad;
人声检测(VAD)结果
注意:
-1: 未开启 VAD。
1: 检测到人声。
@property (copy, nonatomic) NSArray<NSNumber*> * _Nonnull spectrum;
频谱数组。默认长度为 257。
@interface ByteRTCLocalAudioPropertiesInfo : NSObject
本地音频属性信息
| 类型 | 名称 |
|---|---|
| ByteRTCStreamIndex | streamIndex |
| ByteRTCAudioPropertiesInfo* | audioPropertiesInfo |
@property (assign, nonatomic) ByteRTCStreamIndex streamIndex;
流属性,包括主流、屏幕流。参看 ByteRTCStreamIndex
@property (strong, nonatomic) ByteRTCAudioPropertiesInfo *_Nonnull audioPropertiesInfo;
音频属性信息,详见 ByteRTCAudioPropertiesInfo
@interface ByteRTCRemoteAudioPropertiesInfo : NSObject
远端音频属性信息
| 类型 | 名称 |
|---|---|
| ByteRTCRemoteStreamKey* | streamKey |
| ByteRTCAudioPropertiesInfo* | audioPropertiesInfo |
@property (strong, nonatomic) ByteRTCRemoteStreamKey *_Nonnull streamKey;
远端流信息,详见 ByteRTCRemoteStreamKey
@property (strong, nonatomic) ByteRTCAudioPropertiesInfo *_Nonnull audioPropertiesInfo;
音频属性信息,详见 ByteRTCAudioPropertiesInfo
@interface ReceiveRange : NSObject
使用范围语音功能时,语音的接收范围
| 类型 | 名称 |
|---|---|
| int | min |
| int | max |
@property (nonatomic, assign) int min;
收听声音无衰减的最小范围值。
当收听者和声源距离小于 min 的时候,收听到的声音完全无衰减。
@property (nonatomic, assign) int max;
能够收听到声音的最大范围。
当收听者和声源距离大于 max 的时候,无法收听到声音。
当收听者和声源距离处于 [min, max) 之间时,收听到的音量根据距离有衰减。
@interface Position : NSObject
用户的位置信息
| 类型 | 名称 |
|---|---|
| int | x |
| int | y |
| int | z |
@property (nonatomic, assign) int x;
x 坐标
@property (nonatomic, assign) int y;
y 坐标
@property (nonatomic, assign) int z;
z 坐标
@interface Orientation : NSObject
方向朝向信息
| 类型 | 名称 |
|---|---|
| float | x |
| float | y |
| float | z |
@property (nonatomic, assign) float x;
x 方向向量
@property (nonatomic, assign) float y;
y 方向向量
@property (nonatomic, assign) float z;
z 方向向量
@interface HumanOrientation : NSObject
用户的三维方向朝向信息,三个向量需要两两垂直
| 类型 | 名称 |
|---|---|
| Orientation* | forward |
| Orientation* | right |
| Orientation* | up |
@property (nonatomic, strong) Orientation* _Nonnull forward;
正前方朝向向量
@property (nonatomic, strong) Orientation* _Nonnull right;
正右方朝向向量
@property (nonatomic, strong) Orientation* _Nonnull up;
正上方朝向向量
typedef NS_ENUM(NSInteger, ByteRTCSyncInfoStreamType)
媒体流信息同步的流类型
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCSyncInfoStreamTypeAudio | 0 | 音频流 |
typedef NS_ENUM(NSInteger, ByteRTCTorchState)
相机补光灯状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCTorchStateOff | 0 | 相机补光灯关闭 |
| ByteRTCTorchStateOn | 1 | 相机补光灯打开 |
@interface ByteRTCStreamSycnInfoConfig : NSObject
媒体流信息同步的相关配置
| 类型 | 名称 |
|---|---|
| ByteRTCStreamIndex | streamIndex |
| int | repeatCount |
| ByteRTCSyncInfoStreamType | streamType |
@property (assign, nonatomic) ByteRTCStreamIndex streamIndex;
流属性,主流或屏幕流。见 ByteRTCStreamIndex 。
@property (assign, nonatomic) int repeatCount;
消息发送的重复次数,取值范围是 [0,25],建议设置为 [3,5]。
@property (assign, nonatomic) ByteRTCSyncInfoStreamType streamType;
媒体流信息同步的流类型,见 ByteRTCSyncInfoStreamType 。
typedef NS_ENUM(NSInteger, ByteRTCForwardStreamState)
媒体流跨房间转发状态
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCForwardStreamStateIdle | 0 | 空闲状态 + 成功调用 stopForwardStreamToRooms 后,所有目标房间为空闲状态。 + 成功调用 updateForwardStreamToRooms: 减少目标房间后,本次减少的目标房间为空闲状态。 |
| ByteRTCForwardStreamStateSuccess | 1 | 开始转发 + 调用 startForwardStreamToRooms: 成功向所有房间开始转发媒体流后,返回此状态。 + 调用 updateForwardStreamToRooms: 后,成功向新增目标房间开始转发媒体流后,返回此状态。 |
| ByteRTCForwardStreamStateFailure | 2 | 转发失败,失败详情参考 ByteRTCForwardStreamError 调用 startForwardStreamToRooms: 或 updateForwardStreamToRooms: 后,如遇转发失败,返回此状态。 |
typedef NS_ENUM(NSInteger, ByteRTCForwardStreamError)
媒体流跨房间转发过程中抛出的错误码
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCForwardStreamErrorOK | 0 | 正常 |
| ByteRTCForwardStreamErrorInvalidArgument | 1201 | 参数异常 |
| ByteRTCForwardStreamErrorInvalidToken | 1202 | Token 错误 |
| ByteRTCForwardStreamErrorResponse | 1203 | 服务端异常 |
| ByteRTCForwardStreamErrorRemoteKicked | 1204 | 目标房间有相同 user id 的用户加入,转发中断 |
| ByteRTCForwardStreamErrorNotSupport | 1205 | 服务端不支持转发功能 |
typedef NS_ENUM(NSInteger, ByteRTCForwardStreamEvent)
媒体流跨房间转发事件
| 类型 | 值 | 说明 |
|---|---|---|
| ByteRTCForwardStreamEventDisconnected | 0 | 本端与服务器网络连接断开,暂停转发。 |
| ByteRTCForwardStreamEventConnected | 1 | 本端与服务器网络连接恢复,转发服务连接成功。 |
| ByteRTCForwardStreamEventInterrupt | 2 | 转发中断。转发过程中,如果相同 user_id 的用户进入目标房间,转发中断。 |
| ByteRTCForwardStreamEventDstRoomUpdated | 3 | 目标房间已更新,由 updateForwardStreamToRooms: 触发。 |
| ByteRTCForwardStreamEventUnExpectAPICall | 4 | API 调用时序错误。例如,在调用 startForwardStreamToRooms: 之前调用 updateForwardStreamToRooms: 。 |
@interface ForwardStreamConfiguration: NSObject
媒体流跨房间转发的目标房间的相关信息
| 类型 | 名称 |
|---|---|
| NSString* | roomId |
| NSString* | token |
@property (strong, nonatomic) NSString* _Nullable roomId;
跨间转发媒体流过程中目标房间 ID
@property (strong, nonatomic) NSString* _Nullable token;
用于向该房间转发媒体流的 Token。
如果 Token 无效,转发失败。
@interface ForwardStreamStateInfo: NSObject
跨房间转发媒体流过程中的不同目标房间的状态和错误信息
| 类型 | 名称 |
|---|---|
| NSString* | roomId |
| ByteRTCForwardStreamState | state |
| ByteRTCForwardStreamError | error |
@property (strong, nonatomic) NSString* _Nullable roomId;
跨房间转发媒体流过程中目标房间 ID
空字符串代表所有目标房间
@property (assign, nonatomic) ByteRTCForwardStreamState state;
跨房间转发媒体流过程中该目标房间的状态,参看 ByteRTCForwardStreamState
@property (assign, nonatomic) ByteRTCForwardStreamError error;
跨房间转发媒体流过程中该目标房间抛出的错误码,参看 ByteRTCForwardStreamError
@interface ForwardStreamEventInfo: NSObject
跨房间转发媒体流过程中的不同目标房间发生的事件
| 类型 | 名称 |
|---|---|
| NSString* | roomId |
| ByteRTCForwardStreamEvent | event |
@property (strong, nonatomic) NSString* _Nullable roomId;
跨房间转发媒体流过程中的发生该事件的目标房间 ID
空字符串代表所有目标房间
@property (assign, nonatomic) ByteRTCForwardStreamEvent event;
跨房间转发媒体流过程中该目标房间发生的事件,参看 ByteRTCForwardStreamEvent
@protocol ByteRTCAudioProcessor <NSObject>
自定义音频处理器
| 返回 | 名称 |
|---|---|
| int | processAudioFrame: |
- (int)processAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;
获取 RTC SDK 采集得到的音频帧,并进行自定义处理,最终将处理后的音频帧给到 RTC SDK 用于编码传输。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | RTC SDK 采集到的音频帧,自定义处理可直接对音频 buffer 中的数据进行修改。参看 ByteRTCAudioFrame。 |
返回值
0: 未处理
>0: 处理成功
< 0: 处理失败
注意 在进行音频自定义处理前,你需要调用 registerLocalAudioProcessor:format: 设置音频自定义处理器。
@protocol ByteRTCASREngineEventHandler<NSObject>
语音识别服务使用状态回调
| 返回 | 名称 |
|---|---|
| void | onSuccess |
| void | onMessage: |
| void | onError:withErrorMessage: |
- (void)onSuccess;
语音识别服务开启成功回调
- (void)onMessage:(NSString *_Nonnull)message;
语音转文字成功回调,该回调返回识别后的全量消息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| message | NSString* | 识别完成后得到的文字消息 |
注意 若识别过程中发生了网络连接中断,则重连后回调的信息中只包含重连后识别的文字消息,不再包含上一次连接后识别的消息。
- (void)onError:(NSInteger)errorCode withErrorMessage:(NSString *_Nonnull)errorMessage;
当语音识别服务内部发生错误事件时触发该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| errorCode | NSInteger | 错误码 • < 0: 参数错误或 API 调用顺序错误,参看 ByteRTCASRErrorCode; • >0: 参看 语音识别服务错误码 |
| errorMessage | NSString* | 错误原因说明 |
@protocol ByteRtcScreenCapturerExtDelegate <NSObject>
Screen capture related extension delegate, used for SDK internal capture only.
The SampleHandler generated after the user creates the extesion needs to inherit this delegate to implement screen sharing related capabilities.
| 返回 | 名称 |
|---|---|
| void | quit |
| void | onReceiveMessageFromApp: |
| void | onSocketDesconnect |
| void | onSocketConnect |
| void | onNotifyAppRunning |
- (void)quit;
Notify Broadcast Upload Extension to stop capturing and exit.
注意 After the user calls stopScreenSharing, this method will be triggered to notify the SDK on the Extension side to stop the screen capture.
- (void)onReceiveMessageFromApp:(NSData *)message;
The callback is triggered when the socket receives a message from the App side
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| message | NSData* | Message received from the App side |
- (void)onSocketDesconnect;
This callback is triggered when the socket is disconnected
- (void)onSocketConnect;
This callback is triggered when the socket is successfully connected
- (void)onNotifyAppRunning;
This callback is triggered when the App is detected to be making an audio/video call.
@interface ByteRtcScreenCapturerExt : NSObject
Screen capture related extension examples, for SDK internal capture only.
The SampleHandler generated by the user after creating the extesion needs to implement screen sharing related capabilities through this instance.
| 返回 | 名称 |
|---|---|
| void | startWithDelegate:groupId: |
| void | stop |
| void | processSampleBuffer:withType: |
- (void)startWithDelegate:(NSObject<ByteRtcScreenCapturerExtDelegate> *)delegate groupId:(NSString *)groupId;
Start screen capture
After the Extension is started, the system will automatically call this method to enable screen capture.
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| delegate | NSObject |
Callback agent, see ByteRtcScreenCapturerExtDelegate |
| groupId | NSString* | The group ID set in App groups |
- (void)stop;
Stop screen capture
After the Extension is closed, the system will automatically call this method to stop screen capture.
- (void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType;
Push data captured by Extension
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| sampleBuffer | CMSampleBufferRef | Captured data |
| sampleBufferType | RPSampleBufferType | Data type |