ByteRTCAudioScenarioType

typedef NS_ENUM(NSInteger, ByteRTCAudioScenarioType)

音频场景类型
选择音频场景后,SDK 会自动根据客户端音频采集播放设备和状态,适用通话音量/媒体音量。
如果以下音频场景类型无法满足你的业务需要,请联系技术支持同学进行定制。

枚举值

类型 值 说明
ByteRTCAudioScenarioMusic 0 (默认)音乐场景

此场景适用于对音乐表现力有要求的场景,如音乐直播等。

音频采集播放设备和采集播放状态,到音量类型的映射如下:






仅采集音频,不播放音频仅播放音频,不采集音频采集并播放音频备注
设备自带麦克风和扬声器/听筒媒体音量媒体音量通话音量/
有线耳机媒体音量媒体音量媒体音量/
蓝牙耳机媒体音量媒体音量媒体音量即使蓝牙耳机有麦克风,也只能使用设备自带麦克风进行本地音频采集。
ByteRTCAudioScenarioHighqualityCommunication 1 高质量通话场景。

此场景适用于对音乐表现力有要求,但又希望能够使用蓝牙耳机上自带的麦克风进行音频采集的场景。

此场景可以兼顾外放/使用蓝牙耳机时的音频体验,并避免使用蓝牙耳机时音量类型切换导致的听感突变。

音频采集播放设备和采集播放状态,到音量类型的映射如下:






仅采集音频,不播放音频仅播放音频,不采集音频采集并播放音频 备注
设备自带麦克风和扬声器/听筒媒体音量媒体音量通话音量/
有线耳机媒体音量媒体音量媒体音量/
蓝牙耳机通话音量通话音量通话音量使用蓝牙耳机上自带的麦克风进行音频采集。
ByteRTCAudioScenarioCommunication 2 纯通话音量场景

此场景下,无论客户端音频路由情况和发布订阅状态,全程使用通话音量。
适用于需要频繁上下麦的通话或会议场景。

此场景可以保持统一的音频模式,不会有音量突变的听感;
最大程度地消除回声,使通话清晰度达到最优;
使用蓝牙耳机时,能够使用蓝牙耳机上自带的麦克风进行音频采集。

但是,会压低使用媒体音量进行播放的其他音频的音量,且音质会变差。
ByteRTCAudioScenarioMedia 3 纯媒体场景(一般不建议使用)

此场景下,无论客户端音频采集播放设备和采集播放状态,全程使用媒体音量。
ByteRTCAudioScenarioGameStreaming 4 游戏媒体场景

此场景下,蓝牙耳机时使用通话音量,其它设备使用媒体音量。
外放通话且无游戏音效消除优化时,极易出现回声和啸叫。

ByteRTCVoiceChangerType

typedef NS_ENUM(NSInteger, ByteRTCVoiceChangerType)

变声特效类型

枚举值

类型 值 说明
ByteRTCVoiceChangerOriginal 0 原声,不含特效
ByteRTCVoiceChangerGiant 1 巨人
ByteRTCVoiceChangerChipmunk 2 花栗鼠
ByteRTCVoiceChangerMinionst 3 小黄人
ByteRTCVoiceChangerVibrato 4 颤音
ByteRTCVoiceChangerRobot 5 机器人

ByteRTCVoiceReverbType

typedef NS_ENUM(NSInteger, ByteRTCVoiceReverbType)

混响特效类型

枚举值

类型 值 说明
ByteRTCVoiceReverbOriginal 0 原声,不含特效
ByteRTCVoiceReverbEcho 1 回声
ByteRTCVoiceReverbConcert 2 演唱会
ByteRTCVoiceReverbEthereal 3 空灵
ByteRTCVoiceReverbKTV 4 KTV
ByteRTCVoiceReverbStudio 5 录音棚

ByteRTCAudioProfileType

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 等音乐场景。

游戏场景不建议使用。

ByteRTCAudioDeviceType

typedef NS_ENUM(NSInteger, ByteRTCAudioDeviceType)

当前音频设备类型

枚举值

类型 值 说明
ByteRTCAudioDeviceTypeUnknown -1 未知音频设备
ByteRTCAudioDeviceTypeRenderDevice 0 音频渲染设备
ByteRTCAudioDeviceTypeCaptureDevice 1 音频采集设备
ByteRTCAudioDeviceTypeScreenCaptureDevice 2 屏幕流音频设备

ByteRTCAudioSampleRate

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

ByteRTCAudioChannel

typedef NS_ENUM(NSInteger, ByteRTCAudioChannel)

音频声道。

枚举值

类型 值 说明
ByteRTCAudioChannelAuto -1 默认设置。
ByteRTCAudioChannelMono 1 单声道
ByteRTCAudioChannelStereo 2 双声道

ByteRTCAACProfile

typedef NS_ENUM(NSInteger, ByteRTCAACProfile)

AAC 编码类型。

枚举值

类型 值 说明
ByteRTCAACProfileLC 0 LC(默认)
ByteRTCAACProfileHEv1 1 HEv1
ByteRTCAACProfileHEv2 2 HEv2

ByteRTCAudioRoute

typedef NS_ENUM(NSInteger, ByteRTCAudioRoute)

音频播放路由

枚举值

类型 值 说明
ByteRTCAudioRouteUnknown -1 未知设备
ByteRTCAudioRouteHeadset 1 有线耳机
ByteRTCAudioRouteEarpiece 2 听筒。设备自带的,一般用于通话的播放硬件。
ByteRTCAudioRouteSpeakerphone 3 扬声器。设备自带的,一般用于免提播放的硬件。
ByteRTCAudioRouteHeadsetBluetooth 4 蓝牙耳机
ByteRTCAudioRouteHeadsetUSB 5 USB设备

ByteRTCAudioPlaybackDevice

typedef NS_ENUM(NSInteger, ByteRTCAudioPlaybackDevice)

音频播放设备
音频设备变化时 SDK 通过 rtcEngine:onAudioPlaybackDeviceChanged: 回调当前音频播放设备。

枚举值

类型 值 说明
ByteRTCAudioPlaybackDeviceHeadset 1 有线耳机
ByteRTCAudioPlaybackDeviceEarpiece 2 听筒
ByteRTCAudioPlaybackDeviceSpeakerphone 3 扬声器
ByteRTCAudioPlaybackDeviceHeadsetBluetooth 4 蓝牙耳机
ByteRTCAudioPlaybackDeviceHeadsetUSB 5 USB设备

ByteRTCASRAuthorizationType

typedef NS_ENUM(NSInteger, ByteRTCASRAuthorizationType)

语音识别服务鉴权方式,详情请咨询语音识别服务服务相关同学

枚举值

类型 值 说明
ByteRTCASRAuthorizationTypeToken 0 使用 token 不设置加密形式。
ByteRTCASRAuthorizationTypeSignature 1 带有 token 额外使用 signature 加密,此种加密形式需要额外传递 secret token 。

ByteRTCASRErrorCode

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 技术支持。

ByteRTCAudioMixingType

typedef NS_ENUM(NSInteger, ByteRTCAudioMixingType)

混音播放类型

枚举值

类型 值 说明
ByteRTCAudioMixingTypePlayout 0 仅本地播放
ByteRTCAudioMixingTypePublish 1 仅发送到远端
ByteRTCAudioMixingTypePlayoutAndPublish 2 在本地播放并发送到远端

ByteRTCAudioMixingDualMonoMode

typedef NS_ENUM(NSInteger, ByteRTCAudioMixingDualMonoMode)

混音播放声道类型

枚举值

类型 值 说明
ByteRTCAudioMixingDualMonoModeAuto 0 和音频文件一致
ByteRTCAudioMixingDualMonoModeL 1 只能听到音频文件中左声道的音频
ByteRTCAudioMixingDualMonoModeR 2 只能听到音频文件中右声道的音频
ByteRTCAudioMixingDualMonoModeMix 3 能同时听到音频文件中左右声道的音频

ByteRTCAudioMixingState

typedef NS_ENUM(NSInteger, ByteRTCAudioMixingState)

音频混音文件播放状态。

枚举值

类型 值 说明
ByteRTCAudioMixingStatePreloaded 0 混音已加载
ByteRTCAudioMixingStatePlaying 0 混音正在播放
ByteRTCAudioMixingStatePaused 1 混音暂停
ByteRTCAudioMixingStateStopped 2 混音停止
ByteRTCAudioMixingStateFailed 3 混音播放失败
ByteRTCAudioMixingStateFinished 4 混音播放结束
ByteRTCAudioMixingStatePCMEnabled 5 准备PCM混音
ByteRTCAudioMixingStatePCMDisabled 6 PCM混音播放结束

ByteRTCAudioMixingError

typedef NS_ENUM(NSInteger, ByteRTCAudioMixingError)

混音错误码。

枚举值

类型 值 说明
ByteRTCAudioMixingErrorOk 0 正常
ByteRTCAudioMixingErrorPreloadFailed 0 预加载失败,找不到混音文件或者文件长度超出 20s
ByteRTCAudioMixingErrorStartFailed 1 混音开启失败,找不到混音文件或者混音文件打开失败
ByteRTCAudioMixingErrorIdNotFound 2 混音 ID 异常
ByteRTCAudioMixingErrorSetPositionFailed 3 设置混音文件的播放位置出错
ByteRTCAudioMixingErrorInValidVolume 4 音量参数不合法,仅支持设置的音量值为[0, 400]
ByteRTCAudioMixingErrorIdTypeNotMatch 5 不支持此混音类型。
ByteRTCAudioMixingErrorLoadConflict 6 已有另一个文件完成了预加载。请先使用 unloadAudioMixing: 卸载此前的文件。
ByteRTCAudioMixingErrorInValidPitch 7 设置混音文件的音调不合法
ByteRTCAudioMixingErrorInValidAudioTrack 8 设置混音文件的音轨不合法
ByteRTCAudioMixingErrorIsStarting 9 混音文件正在启动中
ByteRTCAudioMixingErrorInValidPlaybackSpeed 10 设置混音文件的播放速度不合法

ByteRTCAudioSourceType

typedef NS_ENUM(NSInteger, ByteRTCAudioSourceType)

音频输入源类型

枚举值

类型 值 说明
ByteRTCAudioSourceTypeExternal 0 自定义采集音频源
ByteRTCAudioSourceTypeInternal 0 RTC SDK 内部采集音频源

ByteRTCAudioRenderType

typedef NS_ENUM(NSInteger, ByteRTCAudioRenderType)

音频输出源类型

枚举值

类型 值 说明
ByteRTCAudioRenderTypeExternal 0 自定义渲染音频
ByteRTCAudioRenderTypeInternal 0 RTC SDK 内部渲染音频

ByteRTCEarMonitorMode

typedef NS_ENUM(NSInteger, ByteRTCEarMonitorMode)

开启/关闭耳返功能

枚举值

类型 值 说明
ByteRTCEarMonitorModeOff 0 不开启耳返功能
ByteRTCEarMonitorModeOn 1 开启耳返功能

ByteRTCAudioFrameCallbackMethod

typedef NS_ENUM(NSInteger, ByteRTCAudioFrameCallbackMethod)

音频回调方法

枚举值

类型 值 说明
ByteRTCAudioFrameCallbackRecord 0 本地麦克风录制的音频数据回调
ByteRTCAudioFrameCallbackPlayback 1 订阅的远端所有用户混音后的音频数据回调
ByteRTCAudioFrameCallbackMixed 2 本地麦克风录制和订阅的远端所有用户混音后的音频数据回调
ByteRTCAudioFrameCallbackRemoteUser 3 订阅的远端每个用户混音前的音频数据回调

ByteRTCAudioVolumeInfo

@interface ByteRTCAudioVolumeInfo : NSObject

音频流来源的用户 ID, 及对应的音量。

成员变量

类型 名称
NSString* uid
NSUInteger linearVolume
NSUInteger nonlinearVolume

变量说明

uid

@property(copy, nonatomic) NSString * _Nonnull uid;

音频流来源的用户 ID

linearVolume

@property(assign, nonatomic) NSUInteger linearVolume;

线性音量,取值范围为:[0,255]

nonlinearVolume

@property(assign, nonatomic) NSUInteger nonlinearVolume;

非线性音量,取值范围为:[-127,0]

ByteRTCAudioFormat

@interface ByteRTCAudioFormat : NSObject

音频参数格式

成员变量

类型 名称
ByteRTCAudioSampleRate sampleRate
ByteRTCAudioChannel channel

变量说明

sampleRate

@property(nonatomic, assign) ByteRTCAudioSampleRate sampleRate;

音频采样率,详见 ByteRTCAudioSampleRate

channel

@property(nonatomic, assign) ByteRTCAudioChannel channel;

音频声道,详见 ByteRTCAudioChannel

ByteRTCAudioFrame

@interface ByteRTCAudioFrame : NSObject

PCM 音频帧

成员变量

类型 名称
NSData* buffer
int samples
ByteRTCAudioChannel channel
ByteRTCAudioSampleRate sampleRate

变量说明

buffer

@property(strong, nonatomic) NSData * _Nonnull buffer;

PCM 数据

samples

@property(assign, nonatomic) int samples;

采样点个数

channel

@property(assign, nonatomic) ByteRTCAudioChannel channel;

音频声道,参看 ByteRTCAudioChannel。

sampleRate

@property(assign, nonatomic) ByteRTCAudioSampleRate sampleRate;

采样率,参看 ByteRTCAudioSampleRate。

ByteRTCAudioProcessor

@protocol ByteRTCAudioProcessor <NSObject>

自定义音频处理器

成员函数

返回 名称
int processAudioFrame:

函数说明

processAudioFrame:

- (int)processAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;

获取 RTC SDK 采集得到的音频帧,并进行自定义处理,最终将处理后的音频帧给到 RTC SDK 用于编码传输。

传入参数

参数名 类型 说明
audioFrame ByteRTCAudioFrame* RTC SDK 采集到的音频帧,自定义处理可直接对音频 buffer 中的数据进行修改。参看 ByteRTCAudioFrame。

返回值

0: 未处理
>0: 处理成功
< 0: 处理失败

注意 在进行音频自定义处理前,你需要调用 registerLocalAudioProcessor 设置音频自定义处理器。

ByteRTCASRConfig

@interface ByteRTCASRConfig : NSObject

使用自动语音识别服务所需校验信息

成员变量

类型 名称
NSString* appId
NSString* userId
NSString* accessToken
NSString* secretKey
NSString* cluster
ByteRTCASRAuthorizationType authorizationType

变量说明

appId

@property(copy, nonatomic) NSString *_Nonnull appId;

应用 ID

userId

@property(copy, nonatomic) NSString *_Nonnull userId;

用户 ID

accessToken

@property(copy, nonatomic) NSString *_Nonnull accessToken;

访问令牌

secretKey

@property(copy, nonatomic) NSString *_Nonnull secretKey;

私钥。Signature 鉴权模式下不能为空,token 鉴权模式下为空。参看关于鉴权

cluster

@property(copy, nonatomic) NSString *_Nonnull cluster;

场景信息,参看业务集群

authorizationType

@property(assign, nonatomic) ByteRTCASRAuthorizationType authorizationType;

鉴权模式,参看 ByteRTCASRAuthorizationType

ByteRTCASREngineEventHandler

@protocol ByteRTCASREngineEventHandler<NSObject>

语音识别服务使用状态回调

成员函数

返回 名称
void onSuccess
void onMessage:
void onError:withErrorMessage:

函数说明

onSuccess

- (void)onSuccess;

语音识别服务开启成功回调

onMessage:

- (void)onMessage:(NSString *_Nonnull)message;

语音转文字成功回调,该回调返回识别后的全量消息。

传入参数

参数名 类型 说明
message NSString* 识别完成后得到的文字消息

注意 若识别过程中发生了网络连接中断,则重连后回调的信息中只包含重连后识别的文字消息,不再包含上一次连接后识别的消息。

onError:withErrorMessage:

- (void)onError:(NSInteger)errorCode withErrorMessage:(NSString *_Nonnull)errorMessage;

当语音识别服务内部发生错误事件时触发该回调。

传入参数

参数名 类型 说明
errorCode NSInteger 错误码
• < 0: 参数错误或 API 调用顺序错误,参看 ByteRTCASRErrorCode;
• >0: 参看 语音识别服务错误码
errorMessage NSString* 错误原因说明

ByteRTCAudioMixingConfig

@interface ByteRTCAudioMixingConfig : NSObject

混音配置

成员变量

类型 名称
ByteRTCAudioMixingType type
NSInteger playCount
NSInteger position
NSInteger callbackOnProgressInterval

变量说明

type

@property(assign, nonatomic) ByteRTCAudioMixingType type;

混音播放类型,详见 ByteRTCAudioMixingType

playCount

@property(assign, nonatomic) NSInteger playCount;

混音播放次数

position

@property(assign, nonatomic) NSInteger position;

混音时音频文件播放进度条位置,参数为整数,单位为毫秒

callbackOnProgressInterval

@property(assign, nonatomic) NSInteger callbackOnProgressInterval;

设置音频文件播放进度回调的时间间隔,单位毫秒,并按照设置的值触发 rtcEngine:onAudioMixingPlayingProgress:progress: 回调,默认不回调。

ByteRTCAudioPropertiesConfig

@interface ByteRTCAudioPropertiesConfig : NSObject

音频属性信息提示的相关配置

成员变量

类型 名称
NSInteger interval
BOOL enable_spectrum
BOOL enable_vad

变量说明

interval

@property(assign, nonatomic) NSInteger interval;

信息提示间隔,单位:ms

enable_spectrum

@property(assign, nonatomic) BOOL enable_spectrum;

是否开启音频频谱检测

enable_vad

@property(assign, nonatomic) BOOL enable_vad;

是否开启人声检测 (VAD)

ByteRTCAudioPropertiesInfo

@interface ByteRTCAudioPropertiesInfo : NSObject

音频属性信息

成员变量

类型 名称
NSInteger linearVolume
NSInteger nonlinearVolume
NSInteger vad
NSArray* spectrum

变量说明

linearVolume

@property(assign, nonatomic) NSInteger linearVolume;

线性音量,与原始音量呈线性关系,数值越大,音量越大。取值范围是:[0,255]。

nonlinearVolume

@property(assign, nonatomic) NSInteger nonlinearVolume;

非线性音量。由原始音量的对数值转化而来,因此在中低音量时更灵敏,可以用作 Active Speaker(房间内最活跃用户)的识别。取值范围是:[-127,0],单位 dB。

vad

@property(assign, nonatomic) NSInteger vad;

人声检测(VAD)结果

spectrum

@property(copy, nonatomic) NSArray<NSNumber*> * _Nonnull spectrum;

频谱数组。默认长度为 257。

ByteRTCLocalAudioPropertiesInfo

@interface ByteRTCLocalAudioPropertiesInfo : NSObject

本地音频属性信息

成员变量

类型 名称
ByteRTCStreamIndex streamIndex
ByteRTCAudioPropertiesInfo* audioPropertiesInfo

变量说明

streamIndex

@property(assign, nonatomic) ByteRTCStreamIndex streamIndex;

流属性,包括主流、屏幕流。参看 ByteRTCStreamIndex

audioPropertiesInfo

@property(strong, nonatomic) ByteRTCAudioPropertiesInfo *_Nonnull audioPropertiesInfo;

音频属性信息,详见 ByteRTCAudioPropertiesInfo

ByteRTCRemoteAudioPropertiesInfo

@interface ByteRTCRemoteAudioPropertiesInfo : NSObject

远端音频属性信息

成员变量

类型 名称
ByteRTCRemoteStreamKey* streamKey
ByteRTCAudioPropertiesInfo* audioPropertiesInfo

变量说明

streamKey

@property(strong, nonatomic) ByteRTCRemoteStreamKey *_Nonnull streamKey;

远端流信息,详见 ByteRTCRemoteStreamKey

audioPropertiesInfo

@property(strong, nonatomic) ByteRTCAudioPropertiesInfo *_Nonnull audioPropertiesInfo;

音频属性信息,详见 ByteRTCAudioPropertiesInfo

Position

@interface Position : NSObject

本地用户在房间内的位置坐标,需自行建立空间直角坐标系

成员变量

类型 名称
int x
int y
int z

变量说明

x

@property(nonatomic, assign) int x;

x 坐标

y

@property(nonatomic, assign) int y;

y 坐标

z

@property(nonatomic, assign) int z;

z 坐标

ByteRTCUserOfflineReason

typedef NS_ENUM(NSUInteger, ByteRTCUserOfflineReason)

用户离开房间的原因。

枚举值

类型 值 说明
ByteRTCUserOfflineReasonQuit 0 远端用户调用 leaveRoom 方法主动退出房间。
ByteRTCUserOfflineReasonDropped 1 远端用户因网络等原因掉线。
ByteRTCUserOfflineReasonSwitchToInvisible 2 远端用户切换至隐身状态。
ByteRTCUserOfflineReasonKickedByAdmin 3 远端用户被踢出出房间。
因调用踢出用户的 OpenAPI,远端用户被踢出房间。

ByteRTCStreamRemoveReason

typedef NS_ENUM(NSInteger, ByteRTCStreamRemoveReason)

房间内远端流移除原因。

枚举值

类型 值 说明
ByteRTCStreamRemoveReasonUnpublish 0 远端用户停止发布流。
ByteRTCStreamRemoveReasonPublishFailed 1 远端用户发布流失败。
ByteRTCStreamRemoveReasonKeepLiveFailed 2 保活失败。
ByteRTCStreamRemoveReasonClientDisconnected 3 远端用户断网。
ByteRTCStreamRemoveReasonRepublish 4 远端用户重新发布流。
ByteRTCStreamRemoveReasonOther 5 其他原因。

ByteRTCRoomProfile

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 会使用低延时设置。

当你的场景非游戏或云游戏场景,又需要极低延时的体验时,可以使用该模式。

该模式下,音视频通话延时会明显降低,但同时弱网抗性、通话音质等均会受到一定影响。

在使用此模式前,强烈建议咨询技术支持同学。

ByteRTCConnectionState

typedef NS_ENUM(NSInteger, ByteRTCConnectionState)

SDK 与信令服务器连接状态。

枚举值

类型 值 说明
ByteRTCConnectionStateDisconnected 1 连接中断。
ByteRTCConnectionStateConnecting 2 首次连接,正在连接中。
ByteRTCConnectionStateConnected 3 首次连接成功。
ByteRTCConnectionStateReconnecting 4 连接断开后重新连接中。
ByteRTCConnectionStateReconnected 5 连接断开后重连成功。
ByteRTCConnectionStateLost 6 网络连接断开超过 10 秒,仍然会继续重连。

ByteRTCNetworkType

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 移动网络。

ByteRTCNetworkDetectionStopReason

typedef NS_ENUM(NSUInteger, ByteRTCNetworkDetectionStopReason)

通话前探测的停止原因 rtcEngine:onNetworkDetectionStopped: 回调的参数类型

枚举值

类型 值 说明
ByteRTCNetworkDetectionStopReasonUser 0 用户主动停止。
ByteRTCNetworkDetectionStopReasonTimeout 1 探测超过三分钟。
ByteRTCNetworkDetectionStopReasonConnectionLost 2 探测网络连接断开。

当超过 12s 没有收到回复,SDK 将断开网络连接,并且不再尝试重连。
ByteRTCNetworkDetectionStopReasonStreaming 3 本地开始推拉流,停止探测。
ByteRTCNetworkDetectionStopReasonInnerErr 4 网络探测失败,内部异常

ByteRTCNetworkDetectionLinkType

typedef NS_ENUM(NSUInteger, ByteRTCNetworkDetectionLinkType)

通话前探测链接的类型 rtcEngine:onNetworkDetectionResult:quality:rtt:lostRate:bitrate:jitter: 回调的参数类型

枚举值

类型 值 说明
ByteRTCNetworkDetectionLinkTypeUp 0 上行网络探测。
ByteRTCNetworkDetectionLinkTypeDown 1 下行网络探测。

ByteRTCNetworkQuality

typedef NS_ENUM(NSUInteger, ByteRTCNetworkQuality)

媒体流网络质量。

枚举值

类型 值 说明
ByteRTCNetworkQualityUnknown 0 网络质量未知。
ByteRTCNetworkQualityExcellent 1 网络质量极好。
ByteRTCNetworkQualityGood 2 主观感觉和 kNetworkQualityExcellent 差不多,但码率可能略低。
ByteRTCNetworkQualityPoor 3 主观感受有瑕疵但不影响沟通。
ByteRTCNetworkQualityBad 4 勉强能沟通但不顺畅。
ByteRTCNetworkQualityVeryBad 5 网络质量非常差,基本不能沟通。

ByteRTCSubscribeState

typedef NS_ENUM(NSInteger, ByteRTCSubscribeState)

订阅媒体流状态

枚举值

类型 值 说明
ByteRTCSubscribeStateSuccess 0 订阅/取消订阅流成功
ByteRTCSubscribeStateFailedNotInRoom 1 订阅/取消订阅流失败,本地用户未在房间中
ByteRTCSubscribeStateFailedStreamNotFound 2 订阅/取消订阅流失败,房间内未找到指定的音视频流
ByteRTCSubscribeStateFailedOverLimit 3 超过订阅流数上限

ByteRTCPerformanceAlarmReason

typedef NS_ENUM(NSInteger, ByteRTCPerformanceAlarmReason)

性能回退或者恢复的原因

枚举值

类型 值 说明
ByteRTCPerformanceAlarmReasonBandwidthFallback 0 网络原因差,造成了发送性能回退。仅在开启发送性能回退时,会收到此原因。
ByteRTCPerformanceAlarmReasonBandwidthResumed 1 网络性能恢复,发送性能回退恢复。仅在开启发送性能回退时,会收到此原因。
ByteRTCPerformanceAlarmReasonFallback 2 如果未开启发送性能回退,收到此告警时,意味着性能不足;

如果开启了发送性能回退,收到此告警时,意味着性能不足,且已发生发送性能回退。
ByteRTCPerformanceAlarmReasonResumed 3 如果未开启发送性能回退,收到此告警时,意味着性能不足已恢复;

如果开启了发送性能回退,收到此告警时,意味着性能不足已恢复,且已发生发送性能回退恢复。

ByteRTCPerformanceAlarmMode

typedef NS_ENUM(NSInteger, ByteRTCPerformanceAlarmMode)

性能回退的模式

枚举值

类型 值 说明
ByteRTCPerformanceAlarmModeNormal 0 未开启发布性能回退
ByteRTCPerformanceAlarmModeSimulcast 1 已开启发布性能回退

ByteRTCUserMessageSendResult

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 为空
ByteRTCUserMessageSendResultServerParamsNotSet 106 发送消息给业务方服务器之前没有设置参数
ByteRTCUserMessageSendResultUnknown 1000 失败,未知错误。

ByteRTCUserOnlineStatus

typedef NS_ENUM(NSInteger, ByteRTCUserOnlineStatus)

用户在线状态

枚举值

类型 值 说明
ByteRTCUserOnlineStatusOffline 0 对端用户离线
对端用户已经调用 logout,或者没有调用 login:uid: 进行登录
ByteRTCUserOnlineStatusOnline 1 对端用户在线
对端用户调用 login:uid: 登录,并且连接状态正常
ByteRTCUserOnlineStatusUnreachable 2 无法获取对端用户在线状态
发生级联错误、对端用户在线状态异常时返回

ByteRTCRoomMessageSendResult

typedef NS_ENUM(NSInteger, ByteRTCRoomMessageSendResult)

房间内广播消息发送结果

枚举值

类型 值 说明
ByteRTCRoomMessageSendResultSuccess 200 消息发送成功
ByteRTCRoomMessageSendResultNotJoin 100 失败,发送方未加入房间
ByteRTCRoomMessageSendResultInit 101 失败,连接未完成初始化。
ByteRTCRoomMessageSendResultNoConnection 102 失败,没有可用的连接。
ByteRTCRoomMessageSendResultExceedMaxLength 103 消息超过最大长度,当前为 64KB
ByteRTCRoomMessageSendResultUnknown 1000 失败,未知错误。

ByteRTCPublishFallbackOption

typedef NS_ENUM(NSUInteger, ByteRTCPublishFallbackOption)

发布端音视频流回退选项

枚举值

类型 值 说明
ByteRTCPublishFallbackOptionDisabled 0 上行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。
ByteRTCPublishFallbackOptionSimulcast 1 上行网络不佳或设备性能不足时,发布的视频流会从大流到小流依次降级,直到与当前网络性能匹配从大流开始做降级处理,具体降级规则参看性能回退文档。

ByteRTCSubscribeFallbackOption

typedef NS_ENUM(NSUInteger, ByteRTCSubscribeFallbackOption)

订阅端音视频流回退选项。

枚举值

类型 值 说明
ByteRTCSubscribeFallbackOptionDisabled 0 下行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。
ByteRTCSubscribeFallbackOptionVideoStreamLow 1 下行网络不佳或设备性能不足时,对视频流做降级处理,具体降级规则参看性能回退文档。

该设置仅对发布端调用 enableSimulcastMode: 开启发送多路流功能的情况生效。
ByteRTCSubscribeFallbackOptionAudioOnly 2 下行网络不佳或设备性能不足时,取消接收视频,仅接收音频。

ByteRTCRemoteUserPriority

typedef NS_ENUM(NSUInteger, ByteRTCRemoteUserPriority)

远端用户优先级。在性能不足需要回退时,会先回退优先级低的用户的音视频流

枚举值

类型 值 说明
ByteRTCRemoteUserPriorityLow 0 用户优先级为低,默认值
ByteRTCRemoteUserPriorityMedium 100 用户优先级为正常
ByteRTCRemoteUserPriorityHigh 200 用户优先级为高

ByteRTCFallbackOrRecoverReason

typedef NS_ENUM(NSInteger, ByteRTCFallbackOrRecoverReason)

本地用户订阅的远端流触发回退策略的原因。

枚举值

类型 值 说明
ByteRTCFallbackOrRecoverReasonUnknown -1 其他原因,非带宽和性能原因引起的回退或恢复。默认值
ByteRTCFallbackOrRecoverReasonSubscribeFallbackByBandwidth 0 由带宽不足导致的订阅端音视频流回退。
ByteRTCFallbackOrRecoverReasonSubscribeFallbackByPerformance 1 由性能不足导致的订阅端音视频流回退。
ByteRTCFallbackOrRecoverReasonSubscribeRecoverByBandwidth 2 由带宽恢复导致的订阅端音视频流恢复。
ByteRTCFallbackOrRecoverReasonSubscribeRecoverByPerformance 3 由性能恢复导致的订阅端音视频流恢复。
ByteRTCFallbackOrRecoverReasonPublishFallbackByBandwidth 4 由带宽不足导致的发布端音视频流回退。
ByteRTCFallbackOrRecoverReasonPublishFallbackByPerformance 5 由性能不足导致的发布端音视频流回退。
ByteRTCFallbackOrRecoverReasonPublishRecoverByBandwidth 6 由带宽恢复导致的发布端音视频流恢复。
ByteRTCFallbackOrRecoverReasonPublishRecoverByPerformance 7 由性能恢复导致的发布端音视频流恢复。

ByteRTCLocalAudioStreamState

typedef NS_ENUM(NSInteger, ByteRTCLocalAudioStreamState)

本地音频流状态。
SDK 通过 onLocalAudioStateChanged 回调该状态。

枚举值

类型 值 说明
ByteRTCLocalAudioStreamStateStopped 0 本地音频默认初始状态。
麦克风停止工作时回调该状态,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorOk
ByteRTCLocalAudioStreamStateRecording 1 本地音频录制设备启动成功。
采集到音频首帧时回调该状态,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorOk
ByteRTCLocalAudioStreamStateEncoding 2 本地音频首帧编码成功。
音频首帧编码成功时回调该状态,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorOk
ByteRTCLocalAudioStreamStateFailed 3 本地音频启动失败,在以下时机回调该状态:

+ 本地录音设备启动失败,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorRecordFailure

+ 检测到没有录音设备权限,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamErrorDeviceNoPermission

+ 音频编码失败,对应错误码 ByteRTCLocalAudioStreamError 中的 ByteRTCLocalAudioStreamError

ByteRTCLocalAudioStreamError

typedef NS_ENUM(NSInteger, ByteRTCLocalAudioStreamError)

本地音频流状态改变时的错误码。 SDK 通过 onLocalAudioStateChanged 回调该错误码。

枚举值

类型 值 说明
ByteRTCLocalAudioStreamErrorOk 0 本地音频状态正常
ByteRTCLocalAudioStreamErrorFailure 1 本地音频出错原因未知
ByteRTCLocalAudioStreamErrorDeviceNoPermission 2 没有权限启动本地音频录制设备
ByteRTCLocalAudioStreamErrorRecordFailure 4 本地音频录制失败,建议你检查录制设备是否正常工作
ByteRTCLocalAudioStreamErrorEncodeFailure 5 本地音频编码失败
ByteRTCLocalAudioStreamErrorNoRecordingDevice 6 没有可用的音频录制设备

ByteRTCLocalVideoStreamState

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

ByteRTCLocalVideoStreamError

typedef NS_ENUM(NSInteger, ByteRTCLocalVideoStreamError)

本地视频状态改变时的错误码

枚举值

类型 值 说明
ByteRTCLocalVideoStreamErrorOk 0 本地视频状态正常(本地视频状态改变正常时默认返回值)
ByteRTCLocalVideoStreamErrorFailure 1 本地视频流发布失败
ByteRTCLocalVideoStreamErrorDeviceNoPermission 2 没有权限启动本地视频采集设备
ByteRTCLocalVideoStreamErrorDeviceBusy 3 本地视频采集设备被占用
ByteRTCLocalVideoStreamErrorDeviceNotFound 4 本地视频采集设备不存在或已移除
ByteRTCLocalVideoStreamErrorCaptureFailure 5 本地视频采集失败,建议检查采集设备是否正常工作
ByteRTCLocalVideoStreamErrorEncodeFailure 6 本地视频编码失败
ByteRTCLocalVideoStreamErrorDeviceDisconnected 7 本地视频采集设备被移除

ByteRTCRemoteAudioState

typedef NS_ENUM(NSInteger, ByteRTCRemoteAudioState)

用户订阅的远端音频流状态。
SDK 通过 onRemoteAudioStateChanged 回调该状态。

枚举值

类型 值 说明
ByteRTCRemoteAudioStateStopped 0 远端音频流默认初始状态,在以下时机回调该状态:

+ 本地用户停止接收远端音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonLocalMuted

+ 远端用户停止发送音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonRemoteMuted

+ 远端用户离开房间,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonRemoteOffline
ByteRTCRemoteAudioStateStarting 1 开始接收远端音频流首包。

刚收到远端音频流首包时,会触发回调 onRemoteAudioStateChanged,
对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonLocalUnmuted
ByteRTCRemoteAudioStateDecoding 2 远端音频流正在解码,正常播放,在以下时机回调该状态:

+ 成功解码远端音频首帧,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonLocalUnmuted

+ 网络由阻塞恢复正常,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonNetworkRecovery

+ 本地用户恢复接收远端音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonLocalUnmuted

+ 远端用户恢复发送音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonRemoteUnmuted
ByteRTCRemoteAudioStateFrozen 3 远端音频流卡顿。

网络阻塞导致丢包率大于 40% 时,会触发回调 onRemoteAudioStateChanged,
对应原因是 ByteRTCRemoteAudioStateChangeReason 中的 ByteRTCRemoteAudioStateChangeReasonNetworkCongestion

ByteRTCRemoteAudioStateChangeReason

typedef NS_ENUM(NSInteger, ByteRTCRemoteAudioStateChangeReason)

接收远端音频流状态改变的原因。
用户可以通过 onRemoteAudioStateChanged 了解该状态。

枚举值

类型 值 说明
ByteRTCRemoteAudioStateChangeReasonInternal 0 内部原因
ByteRTCRemoteAudioStateChangeReasonNetworkCongestion 1 网络阻塞
ByteRTCRemoteAudioStateChangeReasonNetworkRecovery 2 网络恢复正常
ByteRTCRemoteAudioStateChangeReasonLocalMuted 3 本地用户停止接收远端音频流
ByteRTCRemoteAudioStateChangeReasonLocalUnmuted 4 本地用户恢复接收远端音频流
ByteRTCRemoteAudioStateChangeReasonRemoteMuted 5 远端用户停止发送音频流
ByteRTCRemoteAudioStateChangeReasonRemoteUnmuted 6 远端用户恢复发送音频流
ByteRTCRemoteAudioStateChangeReasonRemoteOffline 7 远端用户离开房间

ByteRTCRemoteVideoState

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 远端音频流播放失败

ByteRTCRemoteVideoStateChangeReason

typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoStateChangeReason)

远端视频流状态改变的原因

枚举值

类型 值 说明
ByteRTCRemoteVideoStateChangeReasonInternal 0 内部原因
ByteRTCRemoteVideoStateChangeReasonNetworkCongestion 1 网络阻塞
ByteRTCRemoteVideoStateChangeReasonNetworkRecovery 2 网络恢复正常
ByteRTCRemoteVideoStateChangeReasonLocalMuted 3 本地用户停止接收远端视频流或本地用户禁用视频模块
ByteRTCRemoteVideoStateChangeReasonLocalUnmuted 4 本地用户恢复接收远端视频流或本地用户启用视频模块
ByteRTCRemoteVideoStateChangeReasonRemoteMuted 5 远端用户停止发送视频流或远端用户禁用视频模块
ByteRTCRemoteVideoStateChangeReasonRemoteUnmuted 6 远端用户恢复发送视频流或远端用户启用视频模块
ByteRTCRemoteVideoStateChangeReasonRemoteOffline 7 远端用户离开房间

ByteRTCMediaDeviceType

typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceType)

当前媒体设备类型

枚举值

类型 值 说明
ByteRTCMediaDeviceTypeAudioUnknown -1 未知音频设备
ByteRTCMediaDeviceTypeAudioRenderDevice 0 音频渲染设备类型
ByteRTCMediaDeviceTypeAudioCaptureDevice 1 音频采集设备类型
ByteRTCMediaDeviceTypeVideoCaptureDevice 3 视频采集设备类型
ByteRTCMediaDeviceTypeScreenVideoCaptureDevice 4 屏幕流视频设备
ByteRTCMediaDeviceTypeScreenAudioCaptureDevice 5 屏幕流音频设备

ByteRTCMediaDeviceState

typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceState)

媒体设备状态
通过 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error: 或 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error: 回调设备状态。

枚举值

类型 值 说明
ByteRTCMediaDeviceStateStarted 1 设备已开启
ByteRTCMediaDeviceStateStopped 2 设备已停止
ByteRTCMediaDeviceStateRuntimeError 3 设备运行时错误

例如,当媒体设备的预期行为是正常采集,但没有收到采集数据时,将回调该状态。
ByteRTCMediaDeviceStateAdded 10 设备已插入
ByteRTCMediaDeviceStateRemoved 11 设备被移除
ByteRTCMediaDeviceStateInterruptionBegan 12 系统通话,锁屏或第三方应用打断了音视频通话。将在通话结束或第三方应用结束占用后自动恢复。
ByteRTCMediaDeviceStateInterruptionEnded 13 音视频通话已从系统电话或第三方应用打断中恢复

ByteRTCMediaDeviceError

typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceError)

媒体设备错误类型

枚举值

类型 值 说明
ByteRTCMediaDeviceErrorOK 0 媒体设备正常
ByteRTCMediaDeviceErrorDeviceNoPermission 1 没有权限启动媒体设备
ByteRTCMediaDeviceErrorDeviceBusy 2 媒体设备已经在使用中
ByteRTCMediaDeviceErrorDeviceFailure 3 媒体设备错误
ByteRTCMediaDeviceErrorDeviceNotFound 4 未找到指定的媒体设备
ByteRTCMediaDeviceErrorDeviceDisconnected 5 媒体设备被移除
ByteRTCMediaDeviceErrorDeviceNoCallback 6 无采集数据。当媒体设备的预期行为是正常采集,但没有收到采集数据时,将收到该错误。
ByteRTCMediaDeviceErrorUNSupportFormat 7 设备采样率不支持
ByteRTCMediaDeviceErrorNotFindGroupId 8 ios 屏幕采集没有 group id 参数

ByteRTCMediaDeviceWarning

typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceWarning)

媒体设备警告

枚举值

类型 值 说明
ByteRTCMediaDeviceWarningOK 0 无警告
ByteRTCMediaDeviceWarningOperationDenied 1 非法设备操作。在使用外部设备时,调用了 SDK 内部设备 API。
ByteRTCMediaDeviceWarningCaptureSilence 2 采集到的数据为静音帧。

ByteRTCProblemFeedbackOption

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) 耳返延迟大

ByteRTCFirstFrameSendState

typedef NS_ENUM(NSUInteger, ByteRTCFirstFrameSendState)

首帧发送状态

枚举值

类型 值 说明
ByteRTCFirstFrameSendStateSending 0 发送中
ByteRTCFirstFrameSendStateSent 1 发送成功
ByteRTCFirstFrameSendStateEnd 2 发送失败

ByteRTCFirstFramePlayState

typedef NS_ENUM(NSUInteger, ByteRTCFirstFramePlayState)

首帧播放状态

枚举值

类型 值 说明
ByteRTCFirstFramePlayStatePlaying 0
ByteRTCFirstFramePlayStatePlay 1
ByteRTCFirstFramePlayStateEnd 2

ByteRTCEncryptType

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 加密算法

ByteRTCVideoCodecType

typedef NS_ENUM(NSInteger, ByteRTCVideoCodecType)

视频编码类型

枚举值

类型 值 说明
ByteRTCVideoCodecTypeUnknown 0 未知类型
ByteRTCVideoCodecTypeH264 1 标准 H264 编码器
ByteRTCVideoCodecTypeByteVC1 2 标准 ByteVC1 编码器

ByteRTCMuteState

typedef NS_ENUM(NSInteger, ByteRTCMuteState)

音视频流的发送/播放状态

枚举值

类型 值 说明
ByteRTCMuteStateOff 0 发送
ByteRTCMuteStateOn 1 停止发送

ByteRTCStreamIndex

typedef NS_ENUM(NSInteger, ByteRTCStreamIndex)

流属性

枚举值

类型 值 说明
ByteRTCStreamIndexMain 0 主流。包括:

+ 由摄像头/麦克风通过内部采集机制,采集到的视频/音频;

+ 通过自定义采集,采集到的视频/音频。
ByteRTCStreamIndexScreen 1 屏幕流。屏幕共享时共享的视频流,或来自声卡的本地播放音频流。

ByteRTCSyncInfoStreamType

typedef NS_ENUM(NSInteger, ByteRTCSyncInfoStreamType)

媒体流信息同步的流类型

枚举值

类型 值 说明
ByteRTCSyncInfoStreamTypeAudio 0 音频流

ByteRTCForwardStreamState

typedef NS_ENUM(NSInteger, ByteRTCForwardStreamState)

媒体流跨房间转发状态

枚举值

类型 值 说明
ByteRTCForwardStreamStateIdle 0 空闲状态
+ 成功调用 stopForwardStreamToRooms 后,所有目标房间为空闲状态。
+ 成功调用 updateForwardStreamToRooms 减少目标房间后,本次减少的目标房间为空闲状态。
ByteRTCForwardStreamStateSuccess 1 开始转发
+ 调用 startForwardStreamToRooms 成功向所有房间开始转发媒体流后,返回此状态。
+ 调用 updateForwardStreamToRooms 后,成功向新增目标房间开始转发媒体流后,返回此状态。
ByteRTCForwardStreamStateFailure 2 转发失败,失败详情参考 ByteRTCForwardStreamError
调用 startForwardStreamToRooms 或 updateForwardStreamToRooms 后,如遇转发失败,返回此状态。

ByteRTCForwardStreamError

typedef NS_ENUM(NSInteger, ByteRTCForwardStreamError)

媒体流跨房间转发过程中抛出的错误码

枚举值

类型 值 说明
ByteRTCForwardStreamErrorOK 0 正常
ByteRTCForwardStreamErrorInvalidArgument 1201 参数异常
ByteRTCForwardStreamErrorInvalidToken 1202 Token 错误
ByteRTCForwardStreamErrorResponse 1203 服务端异常
ByteRTCForwardStreamErrorRemoteKicked 1204 目标房间有相同 user id 的用户加入,转发中断
ByteRTCForwardStreamErrorNotSupport 1205 服务端不支持转发功能

ByteRTCForwardStreamEvent

typedef NS_ENUM(NSInteger, ByteRTCForwardStreamEvent)

媒体流跨房间转发事件

枚举值

类型 值 说明
ByteRTCForwardStreamEventDisconnected 0 本端与服务器网络连接断开,暂停转发。
ByteRTCForwardStreamEventConnected 1 本端与服务器网络连接恢复,转发服务连接成功。
ByteRTCForwardStreamEventInterrupt 2 转发中断。转发过程中,如果相同 user_id 的用户进入目标房间,转发中断。
ByteRTCForwardStreamEventDstRoomUpdated 3 目标房间已更新,由 updateForwardStreamToRooms 触发。
ByteRTCForwardStreamEventUnExpectAPICall 4 API 调用时序错误。例如,在调用 startForwardStreamToRooms 之前调用 updateForwardStreamToRooms 。

ByteRTCRecordingState

typedef NS_ENUM(NSInteger, ByteRTCRecordingState)

本地录制的状态

枚举值

类型 值 说明
RecordingStateError 0 录制异常
RecordingStateProcessing 1 录制进行中
RecordingStateSuccess 2 录制文件保存成功,调用 stopFileRecording: 结束录制之后才会收到该状态码。

ByteRTCRecordingErrorCode

typedef NS_ENUM(NSInteger, ByteRTCRecordingErrorCode)

本地录制错误码

枚举值

类型 值 说明
RecordingErrorCodeOk 0 录制正常
RecordingErrorCodeNoPermission -1 没有文件写权限
RecordingErrorCodeNotSupport -2 当前版本 SDK 不支持本地录制功能,请联系技术支持人员
RecordingErrorCodeOther -3 其他异常

ByteRTCRecordingFileType

typedef NS_ENUM(NSInteger, ByteRTCRecordingFileType)

本地录制文件的存储格式

枚举值

类型 值 说明
RecordingFileTypeAAC 0 aac 格式文件
RecordingFileTypeMP4 1 mp4 格式文件

ByteRTCAVSyncState

typedef NS_ENUM(NSInteger, ByteRTCAVSyncState)

音视频同步状态

枚举值

类型 值 说明
AVSyncStateAVStreamSyncBegin 0 音视频开始同步
AVSyncStateAudioStreamRemove 1 音视频同步过程中音频移除,但不影响当前的同步关系
AVSyncStateVdieoStreamRemove 2 音视频同步过程中视频移除,但不影响当前的同步关系

ByteRTCUserInfo

@interface ByteRTCUserInfo : NSObject

用户信息。

成员变量

类型 名称
NSString* userId
NSString* extraInfo

变量说明

userId

@property(copy, nonatomic) NSString *_Nonnull userId;

用户 ID。该字符串符合正则表达式:[a-zA-Z0-9_@\-]{1,128}。

extraInfo

@property(copy, nonatomic) NSString *_Nonnull extraInfo;

用户需要透传的额外的信息,字符长度限制为 200 字节。会在 rtcEngine:onUserJoined:elapsed: 中回调给远端用户。

ByteRTCRoomStats

@interface ByteRTCRoomStats : NSObject

房间通话统计数据,统计周期为 2s 。
用户进房成功后,SDK 会周期性地通过 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
NSInteger tx_cellular_kbitrate
NSInteger rx_cellular_kbitrate

变量说明

duration

@property(assign, nonatomic) NSInteger duration;

用户进房开始通话后的总时长,单位为 s ,累计值

txBytes

@property(assign, nonatomic) NSInteger txBytes;

本地用户的总发送字节数 (bytes),累计值

rxBytes

@property(assign, nonatomic) NSInteger rxBytes;

本地用户的总接收字节数 (bytes),累计值

txAudioKBitrate

@property(assign, nonatomic) NSInteger txAudioKBitrate;

本地用户的音频发送码率 (kbps),瞬时值

rxAudioKBitrate

@property(assign, nonatomic) NSInteger rxAudioKBitrate;

本地用户的音频接收码率 (kbps),瞬时值

txVideoKBitrate

@property(assign, nonatomic) NSInteger txVideoKBitrate;

本地用户的视频发送码率 (kbps),瞬时值

rxVideoKBitrate

@property(assign, nonatomic) NSInteger rxVideoKBitrate;

本地用户的视频接收码率 (kbps),瞬时值

userCount

@property(assign, nonatomic) NSInteger userCount;

当前房间内的可见用户人数,包括本地用户自身

rxLostrate

@property(assign, nonatomic) float rxLostrate;

App 现在的下行丢包率

txLostrate

@property(assign, nonatomic) float txLostrate;

App 现在的上行丢包率

rtt

@property(assign, nonatomic) NSInteger rtt;

客户端到服务端的往返时延

txJitter

@property(assign, nonatomic) NSInteger txJitter;

系统上行网络抖动(ms)

rxJitter

@property(assign, nonatomic) NSInteger rxJitter;

系统下行网络抖动(ms)

tx_cellular_kbitrate

@property(assign, nonatomic) NSInteger tx_cellular_kbitrate;

rx_cellular_kbitrate

@property(assign, nonatomic) NSInteger rx_cellular_kbitrate;

ByteRTCSysStats

@interface ByteRTCSysStats : NSObject

App 使用的 cpu 和 memory 信息
信息由 SDK 周期性(2s)地通过 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

变量说明

cpu_cores

@property(assign, nonatomic) unsigned int cpu_cores;

当前系统 cpu 核数

cpu_app_usage

@property(assign, nonatomic) double cpu_app_usage;

当前应用的 CPU 使用率,取值范围为 [0, 1]。

cpu_total_usage

@property(assign, nonatomic) double cpu_total_usage;

当前系统的 CPU 使用率,取值范围为 [0, 1]。

memory_usage

@property(assign, nonatomic) double memory_usage;

当前App的内存使用(单位 MB)

full_memory

@property(assign, nonatomic) unsigned long long full_memory;

全量内存(单位MB)

total_memory_usage

@property(assign, nonatomic) unsigned long long total_memory_usage;

系统已使用内存(单位MB)

free_memory

@property(assign, nonatomic) unsigned long long free_memory;

空闲可分配内存(单位MB)

memory_ratio

@property(assign, nonatomic) double memory_ratio;

当前应用的内存使用率(单位 %)

total_memory_ratio

@property(assign, nonatomic) double total_memory_ratio;

系统内存使用率(单位 %)

ByteRTCLocalVideoStats

@interface ByteRTCLocalVideoStats : NSObject

本地视频流统计信息,统计周期为 2s 。
本地用户发布视频流成功后,SDK 会周期性地通过 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

变量说明

sentKBitrate

@property(assign, nonatomic) float sentKBitrate;

发送的码率。此次统计周期内的视频发送码率,单位为 kbps 。

inputFrameRate

@property(assign, nonatomic) NSInteger inputFrameRate;

采集帧率。此次统计周期内的视频采集帧率,单位为 fps 。

sentFrameRate

@property(assign, nonatomic) NSInteger sentFrameRate;

发送帧率。此次统计周期内的视频发送帧率,单位为 fps 。

encoderOutputFrameRate

@property(assign, nonatomic) NSInteger encoderOutputFrameRate;

编码器输出帧率。当前编码器在此次统计周期内的输出帧率,单位为 fps 。

rendererOutputFrameRate

@property(assign, nonatomic) NSInteger rendererOutputFrameRate;

本地渲染帧率。此次统计周期内的本地视频渲染帧率,单位为 fps 。

sentTargetKBitrate

@property(assign, nonatomic) NSInteger sentTargetKBitrate;

目标发送码率。此次统计周期内的视频目标发送码率,单位为 kbps 。

sentTargetFrameRate

@property(assign, nonatomic) NSInteger sentTargetFrameRate;

目标发送帧率。当前编码器在此次统计周期内的目标发送帧率,单位为 fps 。

statsInterval

@property(assign, nonatomic) NSInteger statsInterval;

统计间隔,单位为 ms 。

注意: 此字段用于设置回调的统计周期,默认设置为 2s 。 此字段用于设置回调的统计周期,默认设置为 2s 。

videoLossRate

@property(assign, nonatomic) float videoLossRate;

视频丢包率。统计周期内的视频上行丢包率,取值范围为 [0, 1] 。

rtt

@property(assign, nonatomic) NSInteger rtt;

往返时延。单位为 ms 。

encodedBitrate

@property(assign, nonatomic) NSInteger encodedBitrate;

视频编码码率。此次统计周期内的视频编码码率,单位为 kbps 。

encodedFrameWidth

@property(assign, nonatomic) NSInteger encodedFrameWidth;

视频编码宽度,单位为 px 。

encodedFrameHeight

@property(assign, nonatomic) NSInteger encodedFrameHeight;

视频编码高度,单位为 px 。

encodedFrameCount

@property(assign, nonatomic) NSInteger encodedFrameCount;

此次统计周期内发送的视频帧总数。

codecType

@property(nonatomic) ByteRTCVideoCodecType codecType;

编码类型。参看 ByteRTCVideoCodecType 类型。

isScreen

@property(assign, nonatomic) BOOL isScreen;

所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。

jitter

@property(assign, nonatomic) NSInteger jitter;

视频上行网络抖动,单位为 ms。

ByteRTCRemoteVideoStats

@interface ByteRTCRemoteVideoStats : NSObject

远端音频流统计信息,统计周期为 2s 。
本地用户订阅远端音频流成功后,SDK 会周期性地通过 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

变量说明

width

@property(assign, nonatomic) NSInteger width;

远端视频宽度。

height

@property(assign, nonatomic) NSInteger height;

远端视频高度。

videoLossRate

@property(assign, nonatomic) float videoLossRate;

远端视频丢包率。统计周期内的视频下行丢包率,取值范围为 [0, 1] 。

receivedKBitrate

@property(assign, nonatomic) float receivedKBitrate;

接收码率。统计周期内的视频接收码率,单位为 kbps 。

receivedFrameRate

@property(assign, nonatomic) NSInteger receivedFrameRate;

远端视频接收帧率。

decoderOutputFrameRate

@property(assign, nonatomic) NSInteger decoderOutputFrameRate;

远端视频解码输出帧率。

renderOutputFrameRate

@property(assign, nonatomic) NSInteger renderOutputFrameRate;

远端视频渲染输出帧率。

stallCount

@property(assign, nonatomic) NSInteger stallCount;

远端视频卡顿次数。

stallDuration

@property(assign, nonatomic) NSInteger stallDuration;

远端视频卡顿时长,单位为 ms 。

e2eDelay

@property(assign, nonatomic) NSInteger e2eDelay;

用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。

isScreen

@property(assign, nonatomic) BOOL isScreen;

远端视频流是否是屏幕共享流。你可以知道当前数据来自主流还是屏幕流。

statsInterval

@property(assign, nonatomic) NSInteger statsInterval;

统计间隔,此次统计周期的间隔,单位为 ms 。

注意: 此字段用于设置回调的统计周期,目前设置为 2s 。 此字段用于设置回调的统计周期,目前设置为 2s 。

rtt

@property(assign, nonatomic) NSInteger rtt;

往返时延。单位为 ms 。

frozenRate

@property(assign, nonatomic) NSInteger frozenRate;

远端用户在进房后发生视频卡顿的累计时长占视频总有效时长的百分比(%)。视频有效时长是指远端用户进房发布视频流后,除停止发送视频流和禁用视频模块之外的视频时长。

videoIndex

@property(assign, nonatomic) NSInteger videoIndex;

SDK 订阅的远端视频流的分辨率下标。

jitter

@property(assign, nonatomic) NSInteger jitter;

视频下行网络抖动,单位为 ms。

ByteRTCLocalAudioStats

@interface ByteRTCLocalAudioStats : NSObject

本地音频流统计信息,统计周期为 2s 。
本地用户发布音频流成功后,SDK 会周期性地通过 onLocalStreamStats 通知本地用户发布的音频流在此次统计周期内的发送状况。此数据结构即为回调给本地用户的参数类型。

成员变量

类型 名称
float audioLossRate
float sentKBitrate
NSInteger recordSampleRate
NSInteger statsInterval
NSInteger rtt
NSInteger numChannels
NSInteger sentSampleRate
NSInteger jitter

变量说明

audioLossRate

@property(assign, nonatomic) float audioLossRate;

音频丢包率。此次统计周期内的音频上行丢包率,取值范围为 [0, 1] 。

sentKBitrate

@property(assign, nonatomic) float sentKBitrate;

发送的码率。此次统计周期内的音频发送码率,单位为 kbps 。

recordSampleRate

@property(assign, nonatomic) NSInteger recordSampleRate;

采集采样率。此次统计周期内的音频采集采样率信息,单位为 Hz 。

statsInterval

@property(assign, nonatomic) NSInteger statsInterval;

统计间隔。此次统计周期的间隔,单位为 ms 。

注意: 此字段用于设置回调的统计周期,默认设置为 2s 。 此字段用于设置回调的统计周期,默认设置为 2s 。

rtt

@property(assign, nonatomic) NSInteger rtt;

往返时延。单位为 ms 。

numChannels

@property(assign, nonatomic) NSInteger numChannels;

音频声道数。

sentSampleRate

@property(assign, nonatomic) NSInteger sentSampleRate;

音频发送采样率。此次统计周期内的音频发送采样率信息,单位为 Hz 。

jitter

@property(assign, nonatomic) NSInteger jitter;

音频上行网络抖动,单位为 ms。

ByteRTCRemoteAudioStats

@interface ByteRTCRemoteAudioStats : NSObject

远端音频流统计信息,统计周期为 2s 。
本地用户订阅远端音频流成功后,SDK 会周期性地通过 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

变量说明

audioLossRate

@property(assign, nonatomic) float audioLossRate;

音频丢包率。统计周期内的音频下行丢包率,取值范围为 [0, 1] 。

receivedKBitrate

@property(assign, nonatomic) float receivedKBitrate;

接收码率。统计周期内的音频接收码率,单位为 kbps 。

stallCount

@property(assign, nonatomic) NSInteger stallCount;

音频卡顿次数。统计周期内的卡顿次数。

stallDuration

@property(assign, nonatomic) NSInteger stallDuration;

音频卡顿时长。统计周期内的卡顿时长,单位为 ms 。

playoutSampleRate

@property(assign, nonatomic) NSInteger playoutSampleRate;

播放采样率。统计周期内的音频播放采样率信息,单位为 Hz 。

e2eDelay

@property(assign, nonatomic) NSInteger e2eDelay;

用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。

statsInterval

@property(assign, nonatomic) NSInteger statsInterval;

统计间隔。此次统计周期的间隔,单位为 ms 。

rtt

@property(assign, nonatomic) NSInteger rtt;

客户端到服务端数据传输的往返时延,单位为 ms。

total_rtt

@property(assign, nonatomic) NSInteger total_rtt;

发送端——服务端——接收端全链路数据传输往返时延。单位为 ms 。

quality

@property(assign, nonatomic) NSInteger quality;

远端用户发送的音频流质量。值含义参考 ByteRTCNetworkQuality 。

jitterBufferDelay

@property(assign, nonatomic) NSInteger jitterBufferDelay;

因引入 jitter buffer 机制导致的延时。单位为 ms 。

numChannels

@property(assign, nonatomic) NSInteger numChannels;

音频声道数。

receivedSampleRate

@property(assign, nonatomic) NSInteger receivedSampleRate;

音频接收采样率。统计周期内接收到的远端音频采样率信息,单位为 Hz 。

frozenRate

@property(assign, nonatomic) NSInteger frozenRate;

远端用户在加入房间后发生音频卡顿的累计时长占音频总有效时长的百分比。音频有效时长是指远端用户进房发布音频流后,除停止发送音频流和禁用音频模块之外的音频时长。

concealedSamples

@property(assign, nonatomic) NSInteger concealedSamples;

音频 PLC 样点总个数。

concealmentEvent

@property(assign, nonatomic) NSInteger concealmentEvent;

音频丢包补偿(PLC) 累计次数。

decSampleRate

@property(assign, nonatomic) NSInteger decSampleRate;

音频解码采样率。统计周期内的音频解码采样率信息,单位为 Hz 。

decDuration

@property(assign, nonatomic) NSInteger decDuration;

解码时长。对此次统计周期内接收的远端音频流进行解码的总耗时,单位为 s 。

jitter

@property(assign, nonatomic) NSInteger jitter;

视频下行网络抖动,单位为 ms。

ByteRTCLocalStreamStats

@interface ByteRTCLocalStreamStats : NSObject

本地音/视频流统计信息以及网络状况,统计周期为 2s 。
本地用户发布音/视频流成功后,SDK 会周期性地通过 onLocalStreamStats 通知本地用户发布的音/视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。

成员变量

类型 名称
ByteRTCLocalAudioStats* audio_stats
ByteRTCLocalVideoStats* video_stats
BOOL is_screen

变量说明

audio_stats

@property(strong, nonatomic) ByteRTCLocalAudioStats *_Nonnull audio_stats;

本地设备发送音频流的统计信息,详见 ByteRTCLocalAudioStats

video_stats

@property(strong, nonatomic) ByteRTCLocalVideoStats *_Nonnull video_stats;

本地设备发送视频流的统计信息,详见 ByteRTCLocalVideoStats

is_screen

@property(nonatomic, assign) BOOL is_screen;

所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。

ByteRTCRemoteStreamStats

@interface ByteRTCRemoteStreamStats : NSObject

用户订阅的远端音/视频流统计信息以及网络状况,统计周期为 2s 。
订阅远端用户发布音/视频流成功后,SDK 会周期性地通过 onRemoteStreamStats 通知本地用户订阅的远端音/视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。

成员变量

类型 名称
NSString* uid
ByteRTCRemoteAudioStats* audio_stats
ByteRTCRemoteVideoStats* video_stats
BOOL is_screen

变量说明

uid

@property(copy, nonatomic) NSString *_Nonnull uid;

用户 ID 。音频来源的用户 ID 。

audio_stats

@property(strong, nonatomic) ByteRTCRemoteAudioStats *_Nonnull audio_stats;

远端音频流的统计信息,详见 ByteRTCRemoteAudioStats

video_stats

@property(strong, nonatomic) ByteRTCRemoteVideoStats *_Nonnull video_stats;

远端视频流的统计信息,详见 ByteRTCRemoteVideoStats

is_screen

@property(nonatomic, assign) BOOL is_screen;

所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。

ByteRTCUser

@interface ByteRTCUser : NSObject

用户信息

成员变量

类型 名称
NSString* userId
NSString* metaData

变量说明

userId

@property(nonatomic, copy, nullable) NSString *userId;

用户 ID

metaData

@property(nonatomic, copy, nullable) NSString *metaData;

元信息

ByteRTCRemoteStreamKey

@interface ByteRTCRemoteStreamKey : NSObject

用户信息

成员变量

类型 名称
NSString* userId
NSString* roomId
ByteRTCStreamIndex streamIndex

变量说明

userId

@property(nonatomic, copy, nullable) NSString *userId;

用户 ID

roomId

@property(nonatomic, copy, nullable) NSString *roomId;

房间 ID

streamIndex

@property(nonatomic, assign) ByteRTCStreamIndex streamIndex;

流属性,包括主流、屏幕流。参看 ByteRTCStreamIndex

ByteRTCRecordingConfig

@interface ByteRTCRecordingConfig : NSObject

本地录制参数配置

成员变量

类型 名称
NSString* dirPath
ByteRTCRecordingFileType recordingFileType

变量说明

dirPath

@property(strong, nonatomic) NSString* _Nullable dirPath;

录制文件保存的绝对路径。你需要指定一个有读写权限的合法路径。

recordingFileType

@property(assign, nonatomic) ByteRTCRecordingFileType recordingFileType;

录制存储文件格式,参看 ByteRTCRecordingFileType

ByteRTCRecordingProgress

@interface ByteRTCRecordingProgress : NSObject

本地录制进度

成员变量

类型 名称
unsigned duration
unsigned fileSize

变量说明

duration

@property(assign, nonatomic) unsigned long long duration;

当前文件的累计录制时长,单位:毫秒

fileSize

@property(assign, nonatomic) unsigned long long fileSize;

当前录制文件的大小,单位:byte

ByteRTCRecordingInfo

@interface ByteRTCRecordingInfo : NSObject

本地录制的详细信息

成员变量

类型 名称
NSString* filePath
ByteRTCVideoCodecType codecType
NSInteger width
NSInteger height

变量说明

filePath

@property(strong, nonatomic) NSString* _Nullable filePath;

录制文件的绝对路径,包含文件名和文件后缀

codecType

@property(assign, nonatomic) ByteRTCVideoCodecType codecType;

录制文件的视频编码类型,参看 ByteRTCVideoCodecType

width

@property(nonatomic, assign) NSInteger width;

录制视频的宽,单位:像素。纯音频录制请忽略该字段

height

@property(nonatomic, assign) NSInteger height;

录制视频的高,单位:像素。纯音频录制请忽略该字段

ByteRTCStreamSycnInfoConfig

@interface ByteRTCStreamSycnInfoConfig : NSObject

媒体流信息同步的相关配置

成员变量

类型 名称
ByteRTCStreamIndex streamIndex
int repeatCount
ByteRTCSyncInfoStreamType streamType

变量说明

streamIndex

@property(assign, nonatomic) ByteRTCStreamIndex streamIndex;

流属性,主流或屏幕流。见 ByteRTCStreamIndex 。

repeatCount

@property(assign, nonatomic) int repeatCount;

消息发送的重复次数,取值范围是 [0,25],建议设置为 [3,5]。

streamType

@property(assign, nonatomic) ByteRTCSyncInfoStreamType streamType;

媒体流信息同步的流类型,见 ByteRTCSyncInfoStreamType 。

ForwardStreamConfiguration

@interface ForwardStreamConfiguration: NSObject

媒体流跨房间转发的目标房间的相关信息

成员变量

类型 名称
NSString* roomId
NSString* token

变量说明

roomId

@property(strong, nonatomic) NSString* _Nullable roomId;

跨房间转发媒体流过程中目标房间 ID

token

@property(strong, nonatomic) NSString* _Nullable token;

使用转发目标房间 RoomID 和 UserID 生成 Token。
测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。
如果 Token 无效,转发失败。

ForwardStreamStateInfo

@interface ForwardStreamStateInfo: NSObject

跨房间转发媒体流过程中的不同目标房间的状态和错误信息

成员变量

类型 名称
NSString* roomId
ByteRTCForwardStreamState state
ByteRTCForwardStreamError error

变量说明

roomId

@property(strong, nonatomic) NSString* _Nullable roomId;

跨房间转发媒体流过程中目标房间 ID
空字符串代表所有目标房间

state

@property(assign, nonatomic) ByteRTCForwardStreamState state;

跨房间转发媒体流过程中该目标房间的状态,参看 ByteRTCForwardStreamState

error

@property(assign, nonatomic) ByteRTCForwardStreamError error;

跨房间转发媒体流过程中该目标房间抛出的错误码,参看 ByteRTCForwardStreamError

ForwardStreamEventInfo

@interface ForwardStreamEventInfo: NSObject

跨房间转发媒体流过程中的不同目标房间发生的事件

成员变量

类型 名称
NSString* roomId
ByteRTCForwardStreamEvent event

变量说明

roomId

@property(strong, nonatomic) NSString* _Nullable roomId;

跨房间转发媒体流过程中的发生该事件的目标房间 ID
空字符串代表所有目标房间

event

@property(assign, nonatomic) ByteRTCForwardStreamEvent event;

跨房间转发媒体流过程中该目标房间发生的事件,参看 ByteRTCForwardStreamEvent

ByteRTCNetworkQualityStats

@interface ByteRTCNetworkQualityStats: NSObject

上行/下行网络质量

成员变量

类型 名称
NSString* uid
double lossRatio
int rtt
int totalBandwidth
ByteRTCNetworkQuality txQuality
ByteRTCNetworkQuality rxQuality

变量说明

uid

@property(strong, nonatomic) NSString* _Nonnull uid;

用户 ID

lossRatio

@property(assign, nonatomic) double lossRatio;

本端的上行/下行的丢包率,范围 [0.0,1.0] 当 uid 为本地用户时,代表发布流的上行丢包率。 当 uid 为远端用户时,代表接收所有订阅流的下行丢包率。

rtt

@property(assign, nonatomic) int rtt;

当 uid 为本地用户时有效,客户端到服务端的往返延时(RTT),单位:ms

totalBandwidth

@property(assign, nonatomic) int totalBandwidth;

本端的音视频 RTP 包 2 秒内的平均传输速率,单位:bps 当 uid 为本地用户时,代表发送速率。 当 uid 为远端用户时,代表所有订阅流的接收速率。

txQuality

@property(assign, nonatomic) ByteRTCNetworkQuality txQuality;

上行网络质量评分,详见 ByteRTCNetworkQuality。

rxQuality

@property(assign, nonatomic) ByteRTCNetworkQuality rxQuality;

下行网络质量评分,详见 ByteRTCNetworkQuality。

ReceiveRange

@interface ReceiveRange : NSObject

本地用户能收听到、且具有衰减效果的音频接收范围

成员变量

类型 名称
int min
int max

变量说明

min

@property(nonatomic, assign) int min;

能够接收语音、并且具有衰减效果的最小距离值,该值须 ≥ 0,但 ≤ max。
小于该值的范围内没有范围语音效果,即收听到的音频音量相同。

max

@property(nonatomic, assign) int max;

能够收听语音的最大距离值,该值须 > 0 且 ≥ min。
当收听者和声源距离处于 [min, max) 之间时,收听到的音量根据距离呈衰减效果。
超出该值范围的音频将无法收听到。

ByteRTCRangeAudioInfo

@interface ByteRTCRangeAudioInfo : NSObject

范围语音流信息

成员变量

类型 名称
NSString* userId
int factor

变量说明

userId

@property(copy, nonatomic) NSString * _Nonnull userId;

远端音频发布用户 ID

factor

@property(nonatomic, assign) int factor;

本地用户听到该远端音频发布用户的衰减系数,范围 [0,100],数值为 0 时表示远端用户音频音量为 0。

ByteRtcScreenCapturerExtDelegate

@protocol ByteRtcScreenCapturerExtDelegate <NSObject>

屏幕采集相关扩展协议,仅适用于 SDK 内部采集。
用户创建 extesion 后生成的 SampleHandler 需继承此协议以实现屏幕共享相关能力。

成员函数

返回 名称
void onQuitFromApp
void onReceiveMessageFromApp:
void onSocketDisconnect
void onSocketConnect
void onNotifyAppRunning

函数说明

onQuitFromApp

- (void)onQuitFromApp;

通知 Broadcast Upload Extension 停止采集屏幕并退出。

注意 用户调用 stopScreenCapture 后,会触发该方法通知 extension 端的 SDK 停止屏幕采集。

onReceiveMessageFromApp:

- (void)onReceiveMessageFromApp:(NSData *)message;

Socket 收到 App 侧发来的信息时,触发该回调

传入参数

参数名 类型 说明
message NSData* App 侧发送的消息

onSocketDisconnect

- (void)onSocketDisconnect;

Socket 连接断开时触发此回调

onSocketConnect

- (void)onSocketConnect;

Socket 连接成功时触发此回调

onNotifyAppRunning

- (void)onNotifyAppRunning;

检测到 App 正在进行音视频通话时触发此回调。

ByteRtcScreenCapturerExt

@interface ByteRtcScreenCapturerExt : NSObject

屏幕采集相关扩展实例,仅适用于 SDK 内部采集。
用户创建 extesion 后生成的 SampleHandler 需通过此实例实现屏幕共享相关能力。

成员函数

返回 名称
void startWithDelegate:groupId:
void stop
void processSampleBuffer:withType:

函数说明

startWithDelegate:groupId:

- (void)startWithDelegate:(NSObject<ByteRtcScreenCapturerExtDelegate> *)delegate groupId:(NSString *)groupId;

开始屏幕采集
Extension 启动后,系统将自动调用该方法开启屏幕采集。

传入参数

参数名 类型 说明
delegate NSObject* 回调代理,参看 ByteRtcScreenCapturerExtDelegate
groupId NSString* App groups 中配置的 group ID

stop

- (void)stop;

结束屏幕采集
Extension 关闭后,系统将自动调用该方法停止屏幕采集。

processSampleBuffer:withType:

- (void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType API_AVAILABLE(ios(10));

推送 Extension 采集的数据

传入参数

参数名 类型 说明
sampleBuffer CMSampleBufferRef 采集到的数据
sampleBufferType RPSampleBufferType 数据类型

Orientation

@interface Orientation : NSObject

方向朝向信息

成员变量

类型 名称
float x
float y
float z

变量说明

x

@property(nonatomic, assign) float x;

x 方向向量

y

@property(nonatomic, assign) float y;

y 方向向量

z

@property(nonatomic, assign) float z;

z 方向向量

HumanOrientation

@interface HumanOrientation : NSObject

三维朝向信息,三个向量需要两两垂直。参看 Orientation。

成员变量

类型 名称
Orientation* forward
Orientation* right
Orientation* up

变量说明

forward

@property(nonatomic, strong) Orientation* _Nonnull forward;

正前方朝向,默认值为 {1,0,0},即正前方朝向 x 轴正方向

@property(nonatomic, strong) Orientation* _Nonnull right;

正右方朝向,默认值为 {0,1,0},即右手朝向 y 轴正方向

up

@property(nonatomic, strong) Orientation* _Nonnull up;

正上方朝向,默认值为 {0,0,1},即头顶朝向 z 轴正方向

ByteRTCRenderMode

typedef NS_ENUM(NSUInteger, ByteRTCRenderMode)

视频帧渲染设置

枚举值

类型 值 说明
ByteRTCRenderModeHidden 1 视窗填满优先。

视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。

缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。
ByteRTCRenderModeFit 2 视频帧内容全部显示优先。

视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。

缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。
ByteRTCRenderModeFill 3 视频帧自适应画布

视频帧非等比缩放,直至画布被填满。在此过程中,视频帧的长宽比例可能会发生变化。

ByteRTCTranscoderContentControlType

typedef NS_ENUM(NSUInteger, ByteRTCTranscoderContentControlType)

合流输出内容类型

枚举值

类型 值 说明
ByteRTCTranscoderContentControlTypeHasAudioAndVideo 0 输出的混流包含音频和视频
ByteRTCTranscoderContentControlTypeHasAudioOnly 1 输出的混流只包含音频
ByteRTCTranscoderContentControlTypeHasVideoOnly 2 输出的混流只包含视频

ByteRTCVideoStreamType

typedef NS_ENUM(NSInteger, ByteRTCVideoStreamType)

视频流类型 目前C++ SDK 只支持 ByteRTCVideoStreamTypeHigh 类型

枚举值

类型 值 说明
ByteRTCVideoStreamTypeHigh 0 高分辨率视频流
ByteRTCVideoStreamTypeLow 1 低分辨率视频

ByteRTCVideoStreamState

typedef NS_ENUM(NSInteger, ByteRTCVideoStreamState)

设置本地视频属性的返回状态。

枚举值

类型 值 说明
ByteRTCVideoStreamStateSuccess 0 设置本地视频属性成功
ByteRTCVideoStreamStateInvalid -2 本地视频属性参数不合法

ByteRTCVideoOutputOrientationMode

typedef NS_ENUM(NSInteger, ByteRTCVideoOutputOrientationMode)

视频输出方向模式

枚举值

类型 值 说明
ByteRTCVideoOutputOrientationModeAdaptative 0 自适应布局
ByteRTCVideoOutputOrientationModeFixedLandscape 1 横屏布局
ByteRTCVideoOutputOrientationModeFixedPortrait 2 竖屏布局

ByteRTCMirrorType

typedef NS_ENUM(NSUInteger, ByteRTCMirrorType)

镜像类型

枚举值

类型 值 说明
ByteRTCMirrorTypeNone 0 本地预览和编码传输时均无镜像效果
ByteRTCMirrorTypeRender 1 本地预览时有镜像效果,编码传输时无镜像效果
ByteRTCMirrorTypeRenderAndEncoder 3 本地预览和编码传输时均有镜像效果

ByteRTCVideoRotation

typedef NS_ENUM(NSInteger, ByteRTCVideoRotation)

视频旋转信息,枚举类型,定义了以 90 度为间隔的四种旋转模式。

枚举值

类型 值 说明
ByteRTCVideoRotation0 0 视频不做旋转
ByteRTCVideoRotation90 90 视频顺时针旋转 90 度
ByteRTCVideoRotation180 180 视频顺时针旋转 180 度
ByteRTCVideoRotation270 270 视频顺时针旋转 270 度

ByteRTCVideoStreamScaleMode

typedef NS_ENUM(NSInteger, ByteRTCVideoStreamScaleMode)

视频帧缩放模式

枚举值

类型 值 说明
ByteRTCVideoStreamScaleModeAuto 0 自动缩放模式,默认设置为 ByteRTCVideoStreamScaleModeFitWithCropping。
ByteRTCVideoStreamScaleModeStretch 1 对视频帧进行缩放,直至充满和视窗分辨率一致为止。这一过程不保证等比缩放。
ByteRTCVideoStreamScaleModeFitWithCropping 2 视窗填满优先。

视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。

缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。
ByteRTCVideoStreamScaleModeFitWithFilling 3 视频帧内容全部显示优先。

视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。

缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。保持纵横比来缩放图像,填充短边

ByteRTCVideoPictureType

typedef NS_ENUM(NSInteger, ByteRTCVideoPictureType)

编码帧类型

枚举值

类型 值 说明
ByteRTCVideoPictureTypeUnknown 0 未知类型
ByteRTCVideoPictureTypeI 1 I帧,关键帧,编解码不需要参考其他视频帧
ByteRTCVideoPictureTypeP 2 P帧,向前参考帧,编解码需要参考前一帧视频帧
ByteRTCVideoPictureTypeB 3 B帧,前后参考帧,编解码需要参考前后两帧视频帧

ByteRTCVideoEncoderPreference

typedef NS_ENUM(NSInteger, ByteRTCVideoEncoderPreference)

编码策略偏好

枚举值

类型 值 说明
ByteRTCVideoEncoderPreferenceDisabled 0 无偏好
ByteRTCVideoEncoderPreferenceMaintainFramerate 1 帧率优先
ByteRTCVideoEncoderPreferenceMaintainQuality 2 质量优先
ByteRTCVideoEncoderPreferenceBalance 3 平衡质量与帧率

ByteRTCDataFrameType

typedef NS_ENUM(NSUInteger, ByteRTCDataFrameType)

数据类型

枚举值

类型 值 说明
ByteRTCDataFrameTypeSei 0 SEI 数据
ByteRTCDataFrameTypeRoi 1 人脸识别数据
ByteRTCDataFrameTypeOther 2 其他数据帧类型

ByteRTCVideoCapturePreference

typedef NS_ENUM(NSInteger, ByteRTCVideoCapturePreference)

视频采集模式

枚举值

类型 值 说明
ByteRTCVideoCapturePreferenceAuto 0 (默认)自动设置采集参数。
SDK在开启采集时根据服务端下发的采集配置结合编码参数设置最佳采集参数。
ByteRTCVideoCapturePreferenceMannal 1 手动设置采集参数,包括采集分辨率、帧率。
ByteRTCVideoCapturePreferenceAutoPerformance 2 采集参数与编码参数一致

ByteRTCVideoFrameType

typedef NS_ENUM(NSInteger, ByteRTCVideoFrameType)

视频帧类型

枚举值

类型 值 说明
ByteRTCVideoFrameTypeRawMemory 0 视频帧类型:内存数据
ByteRTCVideoFrameTypePixelBuffer 0 视频帧类型:CVPixelBuffer

ByteRTCVideoPixelFormat

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

ByteRTCVideoSinkPixelFormat

typedef NS_ENUM(NSInteger, ByteRTCVideoSinkPixelFormat)

视频帧编码格式

枚举值

类型 值 说明
ByteRTCVideoSinkPixelFormatOriginal 0 原始视频帧格式
ByteRTCVideoSinkPixelFormatI420 1 YUV I420 格式
ByteRTCVideoSinkPixelFormatBGRA 2 BGRA 格式
ByteRTCVideoSinkPixelFormatNV12 8 YUV NV21 格式

ByteRTCStreamMixingType

typedef NS_ENUM(NSUInteger, ByteRTCStreamMixingType)

合流方式

枚举值

类型 值 说明
ByteRTCStreamMixingTypeByServer 0 通过服务端转推
ByteRTCStreamMixingTypeByClient 1 端云一体转推

ByteRTCStreamMixingEvent

typedef NS_ENUM(NSUInteger, ByteRTCStreamMixingEvent)

合流状态改变事件

枚举值

类型 值 说明
ByteRTCStreamMixingEventStart 1 合流功能触发
ByteRTCStreamMixingEventStartSuccess 2 合流成功
ByteRTCStreamMixingEventStartFailed 3 合流启动失败
ByteRTCStreamMixingEventUpdate 4 更新合流
ByteRTCStreamMixingEventStop 5 合流结束
ByteRTCStreamMixingEventChangeMixType 6 服务端合流/端云一体合流
ByteRTCStreamMixingEventFirstAudioFrameByClientMixer 7 收到合流音频首帧
ByteRTCStreamMixingEventFirstVideoFrameByClientMixer 8 收到合流视频首帧
ByteRTCStreamMixingEventUpdateTimeout 9 更新合流超时
ByteRTCStreamMixingEventStartTimeout 10 开始合流超时
ByteRTCStreamMixingEventRequestParamError 11 合流布局参数错误

ByteRTCSubscribeMediaType

typedef NS_ENUM(NSInteger, ByteRTCSubscribeMediaType)

订阅媒体的类型

枚举值

类型 值 说明
ByteRTCSubscribeMediaTypeNone 0 既不订阅音频,也不订阅视频
ByteRTCSubscribeMediaTypeAudioOnly 1 只订阅音频,不订阅视频
ByteRTCSubscribeMediaTypeVideoOnly 2 只订阅视频,不订阅音频
ByteRTCSubscribeMediaTypeAudioAndVideo 3 同时订阅音频和视频

ByteRTCPauseResumControlMediaType

typedef NS_ENUM(NSInteger, ByteRTCPauseResumControlMediaType)

暂停/恢复接收远端的媒体流类型。

枚举值

类型 值 说明
ByteRTCControlMediaTypeAudio 0 只控制音频,不影响视频
ByteRtcControlMediaTypeVideo 1 只控制视频,不影响音频
ByteRtcControlMediaTypeAudioAndVideo 2 同时控制音频和视频

ByteRTCVideoSourceType

typedef NS_ENUM(NSInteger, ByteRTCVideoSourceType)

视频输入源类型

枚举值

类型 值 说明
ByteRTCVideoSourceTypeExternal 0 自定义采集视频源
ByteRTCVideoSourceTypeInternal 1 内部采集视频源
ByteRTCVideoSourceTypeEncodedManualSimulcast 2 自定义编码视频源。

SDK 不会自动生成多路流,你需要自行生成并推送多路流
ByteRTCVideoSourceTypeEncodedAutoSimulcast 3 自定义编码视频源。

你仅需推送分辨率最大的一路编码后视频流,SDK 将自动转码生成多路小流

ByteRTCVideoDecoderConfig

typedef NS_ENUM(NSInteger, ByteRTCVideoDecoderConfig)

视频解码方式

枚举值

类型 值 说明
ByteRTCVideoDecoderConfigRaw 0 开启 SDK 内部解码,只回调解码后的数据
ByteRTCVideoDecoderConfigEncode 1 开启自定义解码,只回调解码前数据
ByteRTCVideoDecoderConfigBoth 2 开启 SDK 内部解码,同时回调解码前和解码后的数据

ByteRTCVirtualBackgroundSourceType

typedef NS_ENUM(NSInteger, ByteRTCVirtualBackgroundSourceType)

虚拟背景类型。

枚举值

类型 值 说明
ByteRTCVirtualBackgroundSourceTypeColor 0 使用纯色背景替换视频原有背景。
ByteRTCVirtualBackgroundSourceTypeImage 1 使用自定义图片背景替换视频原有背景。

ByteRTCCameraID

typedef NS_ENUM(NSInteger, ByteRTCCameraID)

移动端摄像头

枚举值

类型 值 说明
ByteRTCCameraIDFront 0 前置摄像头
ByteRTCCameraIDBack 1 后置摄像头
ByteRTCCameraIDExternal 2 外接摄像头
ByteRTCCameraIDInvalid 3 无效值

ByteRtcTranscoderErrorCode

typedef NS_ENUM(NSInteger, ByteRtcTranscoderErrorCode)

转推直播错误码

枚举值

类型 值 说明
ByteRtcTranscoderErrorCodeOK 0 推流成功。
ByteRtcTranscoderErrorCodeInvalidParam 1091 客户端 SDK 检测到无效推流参数,请检查合流参数合法性。
ByteRtcTranscoderErrorCodeInvalidState 1092 状态错误,需要在状态机正常状态下发起操作
ByteRtcTranscoderErrorCodeInvalidOperator 1093 无效操作
ByteRtcTranscoderErrorCodeTimeOut 1094 转推直播任务处理超时,请检查网络状态并重试
ByteRtcTranscoderErrorCodeInvalidParamByServer 1095 服务端检测到错误的推流参数
ByteRtcTranscoderErrorCodeSubTimeoutByServer 1096 服务端检测到订阅流超时
ByteRtcTranscoderErrorCodeInvalidStateByServer 1097 合流服务端内部错误。
ByteRtcTranscoderErrorCodeAuthenticationByCDN 1098 合流服务端推 CDN 失败。
ByteRtcTranscoderErrorCodeTimeoutBySignaling 1099 服务端接收信令超时,请检查网络状态并重试。

ByteRTCRecordingType

typedef NS_ENUM(NSInteger, ByteRTCRecordingType)

本地录制的媒体类型

枚举值

类型 值 说明
RecordAudioOnly 0 只录制音频
RecordVideoOnly 1 只录制视频
RecordVideoAndAudio 2 同时录制音频和视频

ByteRTCScreenMediaType

typedef NS_ENUM(NSInteger, ByteRTCScreenMediaType)

屏幕采集媒体类型

枚举值

类型 值 说明
ByteRTCScreenMediaTypeVideoOnly 0 只采集视频数据
ByteRTCScreenMediaTypeAudioOnly 1 只采集音频数据
ByteRTCScreenMediaTypeVideoAndAudio 2 音视频数据都采集

ByteRTCTorchState

typedef NS_ENUM(NSInteger, ByteRTCTorchState)

相机补光灯状态

枚举值

类型 值 说明
ByteRTCTorchStateOff 0 相机补光灯关闭
ByteRTCTorchStateOn 1 相机补光灯打开

ByteRTCVideoDeviceType

typedef NS_ENUM(NSInteger, ByteRTCVideoDeviceType)

当前视频设备类型

枚举值

类型 值 说明
ByteRTCVideoDeviceTypeUnknown -1 未知视频设备
ByteRTCVideoDeviceTypeRenderDevice 0 视频渲染设备类型
ByteRTCVideoDeviceTypeCaptureDevice 1 视频采集设备类型
ByteRTCVideoDeviceTypeScreenCaptureDevice 2 屏幕流视频设备

ByteRTCMediaStreamType

typedef NS_OPTIONS(NSUInteger, ByteRTCMediaStreamType)

媒体流类型

枚举值

类型 值 说明
ByteRTCMediaStreamTypeAudio (1 << 0) 只控制音频
ByteRTCMediaStreamTypeVideo (1 << 1) 只控制视频
ByteRTCMediaStreamTypeBoth ByteRTCMediaStreamTypeAudio ByteRTCMediaStreamTypeVideo

ByteRTCFrameRateRatio

typedef NS_ENUM(NSUInteger, ByteRTCFrameRateRatio)

占发布端原始帧率的比例

枚举值

类型 值 说明
ByteRTCFrameRateRatioOrigin 0 100%
ByteRTCFrameRateRatioHalf 1 50%
ByteRTCFrameRateRatioQuater 2 25%

ByteRTCVideoRotationMode

typedef NS_ENUM(NSUInteger, ByteRTCVideoRotationMode)

视频旋转模式

枚举值

类型 值 说明
ByteRTCVideoRotationModeFollowApp 0 App 方向
ByteRTCVideoRotationModeFollowGSensor 1 重力方向

ByteRTCRectangle

@interface ByteRTCRectangle : NSObject

矩形区域

成员变量

类型 名称
int x
int y
int width
int height

变量说明

x

@property(assign, nonatomic) int x;

矩形区域左上角的 x 坐标

y

@property(assign, nonatomic) int y;

矩形区域左上角的 y 坐标

width

@property(assign, nonatomic) int width;

矩形宽度 (px)

height

@property(assign, nonatomic) int height;

矩形高度(px)

ByteRTCFaceDetectionResult

@interface ByteRTCFaceDetectionResult : NSObject

人脸检测结果

成员变量

类型 名称
int detectResult
int imageWidth
int imageHeight
NSArray* faces

变量说明

detectResult

@property(assign, nonatomic) int detectResult;

人脸检测结果

imageWidth

@property(assign, nonatomic) int imageWidth;

原始图片宽度(px)

imageHeight

@property(assign, nonatomic) int imageHeight;

原始图片高度(px)

faces

@property(nonatomic, copy) NSArray<ByteRTCRectangle *> * faces;

识别到人脸的矩形框。数组的长度和检测到的人脸数量一致。参看 ByteRTCRectangle。

ByteRTCVideoCanvas

@interface ByteRTCVideoCanvas : NSObject

视频帧渲染设置

成员变量

类型 名称
UIView* view
ByteRTCRenderMode renderMode
NSString* roomId
NSString* uid
NSInteger backgroundColor

变量说明

view

@property(strong, nonatomic) UIView* _Nullable view;

本地视图句柄

renderMode

@property(assign, nonatomic) ByteRTCRenderMode renderMode;

渲染模式,参看 ByteRTCRenderMode

roomId

@property(strong, nonatomic) NSString* _Nullable roomId;

房间 ID

uid

@property(strong, nonatomic) NSString* _Nullable uid;

用户 ID

backgroundColor

@property(assign, nonatomic) NSInteger backgroundColor;

用于填充画布空白部分的背景颜色。取值范围是 [0x0000000, 0xFFFFFFFF]。默认值是 0x00000000。其中,透明度设置无效。

ByteRTCFrameExtendedData

@interface ByteRTCFrameExtendedData : NSObject

视频帧附加的数据,视频解码后获得的附加数据

成员变量

类型 名称
ByteRTCDataFrameType frameType
NSData* extendedData
NSInteger extendedDataLen

变量说明

frameType

@property(assign, nonatomic) ByteRTCDataFrameType frameType;

数据类型,详见 ByteRTCDataFrameType。

extendedData

@property(strong, nonatomic) NSData * _Nullable extendedData;

附加数据

extendedDataLen

@property(assign, nonatomic) NSInteger extendedDataLen;

附加数据长度

ByteRTCVideoSolution

@interface ByteRTCVideoSolution: NSObject

视频流参数

成员变量

类型 名称
CGSize videoSize
NSInteger frameRate
NSInteger maxKbps
ByteRTCVideoStreamScaleMode mode
ByteRTCVideoEncoderPreference encoderPreference

变量说明

videoSize

@property(nonatomic, assign) CGSize videoSize;

视频分辨率

frameRate

@property(nonatomic, assign) NSInteger frameRate;

视频预设帧率

maxKbps

@property(nonatomic, assign) NSInteger maxKbps;

最高编码码率(千比特每秒)。建议使用 -1,SDK 会自动根据分辨率和帧率适配合适的码率。

mode

@property(nonatomic, assign) ByteRTCVideoStreamScaleMode mode;

视频帧缩放模式。你可以设置缩放以适应视窗,参见 ByteRTCVideoStreamScaleMode

encoderPreference

@property(nonatomic, assign) ByteRTCVideoEncoderPreference encoderPreference;

视频编码质量策略,参见 ByteRTCVideoEncoderPreference

ByteRTCVideoCaptureConfig

@interface ByteRTCVideoCaptureConfig: NSObject

视频采集参数

成员变量

类型 名称
ByteRTCVideoCapturePreference preference
CGSize videoSize
NSInteger frameRate

变量说明

preference

@property(nonatomic, assign) ByteRTCVideoCapturePreference preference;

视频采集模式,参看 ByteRTCVideoCapturePreference

videoSize

@property(nonatomic, assign) CGSize videoSize;

视频采集分辨率

frameRate

@property(nonatomic, assign) NSInteger frameRate;

视频采集帧率,单位:fps。

ByteRTCStream

@protocol ByteRTCStream <NSObject>

流属性。

成员变量

类型 名称
NSString* userId
BOOL isScreen
BOOL hasVideo
BOOL hasAudio
NSArray* videoStreamDescriptions
ByteRTCVideoSolution* maxVideoStreamDescription

变量说明

userId

@property(nonatomic, copy, readonly) NSString * userId;

发布此流的用户 ID 。

isScreen

@property(nonatomic, assign, readonly) BOOL isScreen;

此流是否为共享屏幕流。

hasVideo

@property(nonatomic, assign, readonly) BOOL hasVideo;

此流是否包括视频流。

hasAudio

@property(nonatomic, assign, readonly) BOOL hasAudio;

流是否包括音频流。

videoStreamDescriptions

@property(nonatomic, copy, readonly) NSArray<ByteRTCVideoSolution *> * videoStreamDescriptions;

视频流的分辨率信息。
当远端用户调用 SetVideoEncoderConfig: 方法发布多个配置的视频流时,此处会包含该用户发布的所有视频流的属性信息。
参看 ByteRTCVideoSolution。

maxVideoStreamDescription

@property(nonatomic, retain, readonly) ByteRTCVideoSolution *maxVideoStreamDescription;

视频流最大分辨率,在开启多分辨率发布订阅时,回调发布端能支持的最大发布分辨率。

ByteRTCStreamEx

@interface ByteRTCStreamEx : NSObject <ByteRTCStream>

流信息

成员变量

类型 名称
NSString* userId
BOOL isScreen
BOOL hasVideo
BOOL hasAudio
NSArray* videoStreamDescriptions
ByteRTCVideoSolution* maxVideoStreamDescription

变量说明

userId

@property(nonatomic, copy, nullable) NSString *userId;

用户ID

isScreen

@property(nonatomic, assign) BOOL isScreen;

流是否为共享屏幕流。

hasVideo

@property(nonatomic, assign) BOOL hasVideo;

该路流中是否包含视频

hasAudio

@property(nonatomic, assign) BOOL hasAudio;

该路流中是否包含音频

videoStreamDescriptions

@property(nonatomic, copy, nullable) NSArray<ByteRTCVideoSolution *> *videoStreamDescriptions;

视频流的分辨率信息,详见 ByteRTCVideoSolution 类。 用户可以通过调用 SetVideoEncoderConfig: 方法在一路流中发布多个不同的视频分辨率。此参数即为流中所有分辨率的相关信息。

maxVideoStreamDescription

@property(nonatomic, retain, nullable) ByteRTCVideoSolution *maxVideoStreamDescription;

视频流最大分辨率,在开启多分辨率发布订阅时,回调发布端能支持的最大发布分辨率。

ByteRTCSubscribeConfig

@interface ByteRTCSubscribeConfig: NSObject

订阅流的参数配置。用户手动订阅一路音视频流所使用的订阅配置参数。
用户关闭自动订阅功能,使用手动订阅模式时,通过调用 subscribeStream 方法订阅音视频流,调用时传入的参数即为此数据类型。

成员变量

类型 名称
BOOL isScreen
BOOL subscribeVideo
BOOL subscribeAudio
NSInteger videoIndex
NSInteger svcLayer
NSInteger width
NSInteger height
NSInteger framerate

变量说明

isScreen

@property(nonatomic, assign) BOOL isScreen;

是否是屏幕流。
用户通过设置此参数,订阅该远端用户发布的屏幕共享流或非屏幕共享流。 YES 为订阅屏幕共享流,NO 为订阅非屏幕共享流,默认值为 YES 。

subscribeVideo

@property(nonatomic, assign) BOOL subscribeVideo;

是否订阅视频。
用户通过设置此参数,选择是否订阅远端流中的视频。 YES 为订阅视频,NO 为不订阅视频,默认值为 YES 。

subscribeAudio

@property(nonatomic, assign) BOOL subscribeAudio;

是否订阅音频。
用户通过设置此参数,选择是否订阅远端流中的音频。YES 为订阅音频,NO 为不订阅音频,默认值为 YES 。

videoIndex

@property(nonatomic, assign) NSInteger videoIndex;

订阅的视频流分辨率下标。
用户可以通过调用 SetVideoEncoderConfig: 方法发布多个不同分辨率的视频。因此订阅流时,需要指定订阅的具体分辨率。此参数即用于指定需订阅的分辨率的下标,默认值为 0 。

svcLayer

@property(nonatomic, assign) NSInteger svcLayer;

订阅的视频流时域分层,默认值为 0。

width

@property(nonatomic, assign) NSInteger width;

订阅的宽度信息,单位:px,默认值为 0。

height

@property(nonatomic, assign) NSInteger height;

订阅的高度信息,单位:px, 默认值为0。

framerate

@property (nonatomic, assign) NSInteger framerate;

期望订阅的最高帧率,单位:fps,默认值为 0,设为大于 0 的值时开始生效。
当发布端帧率低于设定帧率,或订阅端开启性能回退后下行弱网,则帧率会相应下降。
仅码流支持 SVC 分级编码特性时方可生效。

ByteRTCVideoFrame

@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
ByteRTCCameraID cameraId
ByteRTCFrameExtendedData* extendedData

变量说明

format

@property(assign, nonatomic) int format;

视频帧格式,参考 ByteRTCVideoPixelFormat

time

@property(assign, nonatomic) CMTime time;

当前帧的时间戳信息

strideInPixels

@property(assign, nonatomic) int strideInPixels;

每一行像素占用的字节数

width

@property(assign, nonatomic) int width;

视频帧宽度

height

@property(assign, nonatomic) int height;

视频帧高度

textureBuf

@property(assign, nonatomic) CVPixelBufferRef _Nullable textureBuf;

CVPixelBufferRef 类型的数据,当 format 为 kPixelFormatCVPixelBuffer 时有效

dataBuf

@property(strong, nonatomic) NSData * _Nullable dataBuf;

视频帧内存块首地址

cropLeft

@property(assign, nonatomic) int cropLeft;

视频帧左侧被裁剪的尺寸(像素)

cropTop

@property(assign, nonatomic) int cropTop;

视频帧上部被裁剪的尺寸(像素)

cropRight

@property(assign, nonatomic) int cropRight;

视频帧右侧被裁剪的尺寸(像素)

cropBottom

@property(assign, nonatomic) int cropBottom;

视频帧底部被裁剪的尺寸(像素)

rotation

@property(assign, nonatomic) ByteRTCVideoRotation rotation;

视频帧旋转角度:0, 90, 180, 270

cameraId

@property(assign, nonatomic) ByteRTCCameraID cameraId;

视频帧的摄像头信息,参考 ByteRTCCameraID

extendedData

@property(strong, nonatomic) ByteRTCFrameExtendedData * _Nullable extendedData;

视频帧附加的数据

ByteRTCEncodedVideoFrame

@interface ByteRTCEncodedVideoFrame : NSObject

视频帧信息

成员变量

类型 名称
ByteRTCVideoCodecType codecType
ByteRTCVideoPictureType pictureType
SInt64 timestampUs
SInt64 timestampDtsUs
int width
int height
ByteRTCVideoRotation rotation
NSData* data

变量说明

codecType

@property(assign, nonatomic) ByteRTCVideoCodecType codecType;

视频编码类型。参看 ByteRTCVideoCodecType

pictureType

@property(assign, nonatomic) ByteRTCVideoPictureType pictureType;

视频帧类型。参看 ByteRTCVideoPictureType

timestampUs

@property(assign, nonatomic) SInt64 timestampUs;

视频采集时间戳,单位:微秒

timestampDtsUs

@property(assign, nonatomic) SInt64 timestampDtsUs;

视频编码时间戳,单位:微秒

width

@property(assign, nonatomic) int width;

视频帧宽,单位:px

height

@property(assign, nonatomic) int height;

视频帧高,单位:px

rotation

@property(nonatomic, assign) ByteRTCVideoRotation rotation;

视频帧旋转角度。参看 ByteRTCVideoRotation

data

@property(strong, nonatomic) NSData * _Nonnull data;

视频帧数据指针地址

ByteRTCVideoCompositingRegion

@interface ByteRTCVideoCompositingRegion : NSObject

单个视频流在合流中的布局信息。
开启转推直播功能后,在多路视频流合流时,你可以设置其中一路视频流在合流中的预设布局信息。

成员变量

类型 名称
NSString* uid
NSString* roomId
CGFloat x
CGFloat y
CGFloat width
CGFloat height
NSInteger zOrder
BOOL localUser
BOOL screenStream
CGFloat alpha
ByteRTCTranscoderContentControlType contentControl
ByteRTCRenderMode renderMode

变量说明

uid

@property(copy, nonatomic) NSString * _Nonnull uid;

视频流发布用户的用户 ID 。必填。

roomId

@property(copy, nonatomic) NSString * _Nonnull roomId;

媒体流所在房间的房间 ID。
如果此媒体流是通过 startForwardStreamToRooms: 转发到你所在房间的媒体流时,你应将房间 ID 设置为你所在的房间 ID。

x

@property(assign, nonatomic) CGFloat x;

视频流对应区域左上角的横坐标相对整体画面的归一化比例,取值的范围为 [0.0, 1.0)。

y

@property(assign, nonatomic) CGFloat y;

视频流对应区域左上角的纵坐标相对整体画面的归一化比例,取值的范围为 [0.0, 1.0)。

width

@property(assign, nonatomic) CGFloat width;

视频流对应区域宽度相对整体画面的归一化比例,取值的范围为 (0.0, 1.0]。

height

@property(assign, nonatomic) CGFloat height;

视频流对应区域高度相对整体画面的归一化比例,取值的范围为 (0.0, 1.0]。

zOrder

@property(assign, nonatomic) NSInteger zOrder;

用户视频布局在画布中的层级。0为底层,值越大越上层,范围为[0 - 100]。

localUser

@property(assign, nonatomic) BOOL localUser;

是否为本地用户

screenStream

@property(assign, nonatomic) BOOL screenStream;

是否为屏幕流,默认为NO

alpha

@property(assign, nonatomic) CGFloat alpha;

透明度,可选范围为 [0.0, 1.0],0.0 为全透明。

contentControl

@property (assign, nonatomic) ByteRTCTranscoderContentControlType contentControl;

合流内容控制。默认值为 ByteRTCTranscoderContentControlTypeHasAudioAndVideo,参看 ByteRTCTranscoderContentControlType 。

renderMode

@property(assign, nonatomic) ByteRTCRenderMode renderMode;

视频显示模式。详见 ByteRTCRenderMode 数据类型。

ByteRTCVideoCompositingLayout

@interface ByteRTCVideoCompositingLayout : NSObject

视频流合流整体布局信息。
开启转推直播功能后,你可以设置参与合流的每路视频流的预设布局信息和合流背景信息等。

成员变量

类型 名称
NSString* backgroundColor
NSArray* regions
NSString* appData

变量说明

backgroundColor

@property(copy, nonatomic) NSString *_Nonnull backgroundColor;

画布的背景颜色。格式为 RGB 定义下的 Hex 值,如 #FFB6C1 表示浅粉色。默认值 #000000,表示为黑色

regions

@property(copy, nonatomic) NSArray<ByteRTCVideoCompositingRegion *> * _Nonnull regions;

用户布局信息列表。每条流的具体布局详见 ByteRTCVideoCompositingRegion 数据类型。

appData

@property(copy, nonatomic) NSString *_Nonnull appData;

透传的 App 数据。

ByteRTCTranscodingVideoConfig

@interface ByteRTCTranscodingVideoConfig : NSObject

视频转码配置参数。

成员变量

类型 名称
NSString* codec
NSInteger width
NSInteger height
NSInteger fps
NSInteger gop
NSInteger kBitRate
BOOL lowLatency

变量说明

codec

@property(copy, nonatomic) NSString * _Nonnull codec;

codec 编码器。默认值为 0。

width

@property(assign, nonatomic) NSInteger width;

合流视频宽度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 640。

height

@property(assign, nonatomic) NSInteger height;

合流视频高度。单位为 px,范围为 [2, 1080],必须是偶数。默认值为 480。

fps

@property(assign, nonatomic) NSInteger fps;

合流的视频帧率。默认值为 15,取值范围是 [1, 60]。值不合法时,自动调整为默认值。

gop

@property(assign, nonatomic) NSInteger gop;

I 帧间隔。默认值为 4,取值范围为 [1, 5],单位为秒。值不合法时,自动调整为默认值。

kBitRate

@property(assign, nonatomic) NSInteger kBitRate;

合流视频码率。单位为 kbps,取值范围为 [1,10000],默认值为自适应。值不合法时,自动调整为默认值。

lowLatency

@property(assign, nonatomic) BOOL lowLatency;

是否使用低延时特性。

ByteRTCTranscodingAudioConfig

@interface ByteRTCTranscodingAudioConfig : NSObject

音频转码配置参数

成员变量

类型 名称
NSString* codec
NSInteger sampleRate
NSInteger channels
NSInteger kBitRate
ByteRTCAACProfile profile

变量说明

codec

@property(copy, nonatomic) NSString * _Nonnull codec;

音频编码格式,仅支持AAC编码格式。

sampleRate

@property(assign, nonatomic) NSInteger sampleRate;

音频采样率,单位 kHz。可取 32Khz、44.1Khz、48Khz,默认值为 48Khz。

channels

@property(assign, nonatomic) NSInteger channels;

音频声道数。可取 1、2,默认值为 2。

kBitRate

@property(assign, nonatomic) NSInteger kBitRate;

音频码率,单位 Kbps。可取范围 [32Kbps, 192Kbps],默认值为 64Kbps。

profile

@property(assign, nonatomic) ByteRTCAACProfile profile;

AAC 等级,参看 ByteRTCAACProfile。默认值为 0。

ByteRTCLiveTranscoding

@interface ByteRTCLiveTranscoding : NSObject

转推直播配置参数。

成员变量

类型 名称
ByteRTCStreamMixingType expectedMixingType
ByteRTCVideoCompositingLayout* layout
ByteRTCTranscodingVideoConfig* video
ByteRTCTranscodingAudioConfig* audio
NSMutableDictionary* authInfo
NSString* url
NSString* roomId
NSString* userId

静态函数

返回 名称
instancetype defaultTranscoding

变量说明

expectedMixingType

@property(assign, nonatomic) ByteRTCStreamMixingType expectedMixingType;

合流类型,详见 ByteRTCStreamMixingType 数据类型。

layout

@property(strong, nonatomic) ByteRTCVideoCompositingLayout * _Nonnull layout;

视频流合流整体布局信息。
开启转推直播功能后,你可以设置参与合流的每路视频流的预设布局信息和合流背景信息等。详见 ByteRTCVideoCompositingLayout 数据类型。

video

@property(strong, nonatomic) ByteRTCTranscodingVideoConfig * _Nonnull video;

视频转码配置参数。详见 ByteRTCTranscodingVideoConfig 数据类型。

audio

@property(strong, nonatomic) ByteRTCTranscodingAudioConfig * _Nonnull audio;

音频转码配置参数。详见 ByteRTCTranscodingAudioConfig 数据类型。

authInfo

@property(strong, nonatomic) NSMutableDictionary *  _Nullable authInfo;

业务透传鉴权信息

url

@property(copy, nonatomic) NSString * _Nullable url;

推流 CDN 地址。

roomId

@property(copy, nonatomic) NSString * _Nonnull roomId;

推流房间 ID,必填。

userId

@property(copy, nonatomic) NSString * _Nullable userId;

推流用户 ID。

函数说明

defaultTranscoding

+ (instancetype _Nonnull)defaultTranscoding;

获取默认转推直播配置参数。

返回值 转推直播配置参数,参看 ByteRTCLiveTranscoding。

ByteRTCSubscribeVideoConfig

@interface ByteRTCSubscribeVideoConfig : NSObject

视频订阅配置信息

成员变量

类型 名称
NSInteger videoIndex
NSInteger priority

变量说明

videoIndex

@property(assign, nonatomic) NSInteger videoIndex;

订阅的视频流分辨率下标。
当远端用户通过调用 enableSimulcastMode: 方法启动发布多路不同分辨率的视频流时,本地用户需通过此参数指定希望订阅的流。
默认值为 0,即订阅第一路流。
如果不想更改之前的设置,可以输入 -1。

priority

@property(assign, nonatomic) NSInteger priority;

远端用户优先级,参看 ByteRTCRemoteUserPriority,默认值为 0。

ByteRTCSourceWantedData

@interface ByteRTCSourceWantedData : NSObject

性能回退相关数据

成员变量

类型 名称
NSInteger width
NSInteger height
NSInteger frameRate

变量说明

width

@property(nonatomic, assign) NSInteger width;

推荐视频输入宽

height

@property(nonatomic, assign) NSInteger height;

推荐视频输入高

frameRate

@property(nonatomic, assign) NSInteger frameRate;

推荐视频输入帧率

ByteRTCRemoteStreamSwitchEvent

@interface ByteRTCRemoteStreamSwitchEvent : NSObject

流切换信息。本地用户订阅的远端流触发回退策略时的流切换信息。

成员变量

类型 名称
NSString* uid
BOOL isScreen
NSInteger beforeVideoIndex
NSInteger afterVideoIndex
BOOL beforeVideoEnabled
BOOL afterVideoEnabled
ByteRTCFallbackOrRecoverReason reason

变量说明

uid

@property(nonatomic, copy) NSString * _Nonnull uid;

订阅的音视频流的发布者的用户 ID。

isScreen

@property(nonatomic, assign) BOOL isScreen;

流是否是屏幕流

beforeVideoIndex

@property(nonatomic, assign) NSInteger beforeVideoIndex;

流切换前订阅视频流的分辨率对应的索引

afterVideoIndex

@property(nonatomic, assign) NSInteger afterVideoIndex;

流切换后订阅视频流的分辨率对应的索引

beforeVideoEnabled

@property(nonatomic, assign) BOOL beforeVideoEnabled;

流切换前是否有视频流

afterVideoEnabled

@property(nonatomic, assign) BOOL afterVideoEnabled;

流切换后是否有视频流

reason

@property(nonatomic, assign) ByteRTCFallbackOrRecoverReason reason;

流切换原因,详见 ByteRTCFallbackOrRecoverReason。

ByteRTCVideoSinkDelegate

@protocol ByteRTCVideoSinkDelegate <NSObject>

自定义视频渲染器

成员函数

返回 名称
void renderPixelBuffer:rotation:extendedData:

函数说明

renderPixelBuffer:rotation:extendedData:

- (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(ByteRTCVideoRotation)rotation extendedData:(NSData * _Nullable)extendedData;

输出视频的 PixelBuffer

传入参数

参数名 类型 说明
pixelBuffer CVPixelBufferRef 视频的 PixelBuffer
rotation ByteRTCVideoRotation 视频旋转角度,参看 ByteRTCVideoRotation
extendedData NSData* 视频解码后获得的附加数据

ByteRTCVideoPreprocessorConfig

@interface ByteRTCVideoPreprocessorConfig : NSObject

视频处理配置参数

成员变量

类型 名称
ByteRTCVideoPixelFormat required_pixel_format

变量说明

required_pixel_format

@property(nonatomic, assign) ByteRTCVideoPixelFormat required_pixel_format;

视频帧的像素格式,参看 ByteRTCVideoPixelFormat。

ByteRTCScreenCaptureParam

@interface ByteRTCScreenCaptureParam : NSObject

屏幕采集设置参数

成员变量

类型 名称
NSInteger width
NSInteger height
NSInteger frameRate
NSInteger bitrate
BOOL captureMouseCursor

变量说明

width

@property(nonatomic, assign) NSInteger width;

屏幕采集宽度

height

@property(nonatomic, assign) NSInteger height;

屏幕采集高度

frameRate

@property(nonatomic, assign) NSInteger frameRate;

屏幕采集帧率,单位 fps

bitrate

@property(nonatomic, assign) NSInteger bitrate;

发送屏幕采集码率,单位 kbps

captureMouseCursor

@property(nonatomic, assign) BOOL captureMouseCursor;

是否采集鼠标

ByteRTCScreenParam

@interface ByteRTCScreenParam : NSObject

屏幕采集设置参数

成员变量

类型 名称
NSInteger frameRate
NSInteger bitrate

变量说明

frameRate

@property(nonatomic, assign) NSInteger frameRate;

编码帧率,单位为 fps

bitrate

@property(nonatomic, assign) NSInteger bitrate;

编码码率,小于 0 时 SDK 会根据高宽自适应码率, 单位 kbps

ByteRTCVirtualBackgroundSource

@interface ByteRTCVirtualBackgroundSource: NSObject

虚拟背景对象。

成员变量

类型 名称
ByteRTCVirtualBackgroundSourceType sourceType
int sourceColor
NSString* sourcePath

变量说明

sourceType

@property(nonatomic, assign) ByteRTCVirtualBackgroundSourceType sourceType;

虚拟背景类型,详见 ByteRTCVirtualBackgroundSourceType 。

sourceColor

@property int sourceColor;

纯色背景使用的颜色。
格式为 0xAARRGGBB 。

sourcePath

@property(nonatomic) NSString* sourcePath;

自定义图片背景使用的图片的绝对路径。

注意:

ByteRTCVideoFrameInfo

@interface ByteRTCVideoFrameInfo : NSObject

视频帧基础信息

成员变量

类型 名称
NSInteger width
NSInteger height
ByteRTCVideoRotation rotation

变量说明

width

@property(nonatomic, assign) NSInteger width;

视频帧的宽度(像素)

height

@property(nonatomic, assign) NSInteger height;

视频帧的高度(像素)

rotation

@property(nonatomic, assign) ByteRTCVideoRotation rotation;

视频帧顺时针旋转角度。参看 ByteRTCVideoRotation。

ByteRTCVideoEncoderConfig

@interface ByteRTCVideoEncoderConfig: NSObject

视频参数

成员变量

类型 名称
NSInteger width
NSInteger height
NSInteger frameRate
NSInteger maxBitrate
ByteRTCVideoStreamScaleMode scaleMode
ByteRTCVideoEncoderPreference encoderPreference

变量说明

width

@property(nonatomic, assign) NSInteger width;

视频宽度,单位:px

height

@property(nonatomic, assign) NSInteger height;

视频高度,单位:px

frameRate

@property(nonatomic, assign) NSInteger frameRate;

视频帧率,单位:fps

maxBitrate

@property(nonatomic, assign) NSInteger maxBitrate;

最大编码码率,使用 SDK 内部采集时可选设置,自定义采集时必须设置,单位:kbps。
内部采集模式下默认值为 -1,即适配码率模式,系统将根据输入的分辨率和帧率自动计算适用的码率。
设为 0 则不对视频流进行编码发送。

scaleMode

@property(nonatomic, assign) ByteRTCVideoStreamScaleMode scaleMode;

视频帧缩放模式。你可以设置缩放以适应视窗,参见 ByteRTCVideoStreamScaleMode

encoderPreference

@property(nonatomic, assign) ByteRTCVideoEncoderPreference encoderPreference;

视频编码质量策略,参见 ByteRTCVideoEncoderPreference

ByteRTCRemoteVideoConfig

@interface ByteRTCRemoteVideoConfig : NSObject

远端视频帧信息

成员变量

类型 名称
int framerate
int width
int height

变量说明

framerate

@property (nonatomic, assign) int framerate;

期望订阅的最高帧率,单位:fps,默认值为 0,设为大于 0 的值时开始生效。
当发布端帧率低于设定帧率,或订阅端开启性能回退后下行弱网,则帧率会相应下降。
仅码流支持 SVC 分级编码特性时方可生效。

width

@property(nonatomic, assign) int  width;

视频宽度,单位:px

height

@property(nonatomic, assign) int   height;

视频高度,单位:px

ByteRTCRoomConfig

@interface ByteRTCRoomConfig : NSObject

房间参数配置

成员变量

类型 名称
ByteRTCRoomProfile profile
BOOL isAutoPublish
BOOL isAutoSubscribeAudio
BOOL isAutoSubscribeVideo
ByteRTCRemoteVideoConfig* remoteVideoConfig

变量说明

profile

@property(nonatomic) ByteRTCRoomProfile profile;

房间模式,参看 ByteRTCRoomProfile,默认为普通音视频通话模式,进房后不可更改。

isAutoPublish

@property(assign, nonatomic) BOOL isAutoPublish;

是否自动发布音视频流,默认为自动发布。
若调用 setUserVisibility: 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。

isAutoSubscribeAudio

@property(assign, nonatomic) BOOL isAutoSubscribeAudio;

是否自动订阅音频流,默认为自动订阅。

isAutoSubscribeVideo

@property(assign, nonatomic) BOOL isAutoSubscribeVideo;

是否自动订阅主视频流,默认为自动订阅。
屏幕流始终自动订阅,不受该方法影响。

remoteVideoConfig

@property(nonatomic, strong) ByteRTCRemoteVideoConfig * _Nonnull remoteVideoConfig;

远端视频流参数,参看 ByteRTCRemoteVideoConfig

ByteRTCMultiRoomConfig

@interface ByteRTCMultiRoomConfig : NSObject

多房间参数配置

成员变量

类型 名称
ByteRTCRoomProfile profile
BOOL isAutoSubscribeAudio
BOOL isAutoSubscribeVideo
ByteRTCRemoteVideoConfig* remoteVideoConfig

变量说明

profile

@property(nonatomic) ByteRTCRoomProfile profile;

房间模式,参看 ByteRTCRoomProfile,默认为普通音视频通话模式,进房后不可更改。

isAutoSubscribeAudio

@property(assign, nonatomic) BOOL isAutoSubscribeAudio;

是否自动订阅音频流。

isAutoSubscribeVideo

@property(assign, nonatomic) BOOL isAutoSubscribeVideo;

是否自动订阅主视频流。
屏幕流始终自动订阅,不受该方法影响。

remoteVideoConfig

@property(nonatomic, strong) ByteRTCRemoteVideoConfig * _Nonnull remoteVideoConfig;

远端视频流参数,参看 ByteRTCRemoteVideoConfig

ByteRTCSourceCropInfo

@interface ByteRTCSourceCropInfo : NSObject

公共流裁剪信息

成员变量

类型 名称
CGFloat LocationX
CGFloat LocationY
CGFloat WidthProportion
CGFloat HeightProportion

变量说明

LocationX

@property(assign, nonatomic) CGFloat LocationX;

裁剪后得到的视频帧左上角横坐标相对于裁剪前整体画面的归一化比例,取值范围[0.0, 1.0)

LocationY

@property(assign, nonatomic) CGFloat LocationY;

裁剪后得到的视频帧左上角纵坐标相对于裁剪前整体画面的归一化比例,取值范围[0.0, 1.0)

WidthProportion

@property(assign, nonatomic) CGFloat WidthProportion;

裁剪后得到的视频帧宽度相对于裁剪前整体画面的归一化比例,取值范围(0.0, 1.0]

HeightProportion

@property(assign, nonatomic) CGFloat HeightProportion;

裁剪后得到的视频帧高度相对于裁剪前整体画面的归一化比例,取值范围(0.0, 1.0]

ByteRTCPublicStreamRegion

@interface ByteRTCPublicStreamRegion : NSObject

合成公共流的每条流的布局信息

成员变量

类型 名称
NSString* userId
NSString* roomId
NSString* alternateImage
CGFloat x
CGFloat y
CGFloat width
CGFloat height
NSInteger zOrder
CGFloat alpha
NSInteger mediaType
NSInteger streamType
ByteRTCRenderMode renderMode
ByteRTCSourceCropInfo* sourceCrop

变量说明

userId

@property(copy, nonatomic) NSString * _Nonnull userId;

用户 ID

roomId

@property(copy, nonatomic) NSString * _Nonnull roomId;

房间 ID

alternateImage

@property(copy, nonatomic) NSString * _Nonnull alternateImage;

背景图片地址

x

@property(assign, nonatomic) CGFloat x;

用户视频布局相对画布左侧的偏移量, 相对值。范围[0.0 - 1.0]

y

@property(assign, nonatomic) CGFloat y;

用户视频布局相对画布顶端的偏移量, 相对值。范围[0.0 - 1.0]

width

@property(assign, nonatomic) CGFloat width;

用户视频宽度相对用户原始视频宽度的比例,相对值。范围[0.0 - 1.0]

height

@property(assign, nonatomic) CGFloat height;

用户视频高度相对用户原始视频高度的比例,相对值。范围[0.0 - 1.0]

zOrder

@property(assign, nonatomic) NSInteger zOrder;

用户视频布局在画布中的层级,0为底层,值越大越上层。范围[0 - 100]

alpha

@property(assign, nonatomic) CGFloat alpha;

透明度,范围 [0.0, 1.0]

mediaType

@property(assign, nonatomic) NSInteger mediaType;

推流内容控制。默认为0。
0: 输出的混流包含音视频
1: 只包含音频
2: 表示只包含视频

streamType

@property(assign, nonatomic) NSInteger streamType;

推流媒体类型
0:普通音视频流
1: 屏幕流

renderMode

@property(assign, nonatomic) ByteRTCRenderMode renderMode;

视频显示模式

sourceCrop

@property(strong, nonatomic) ByteRTCSourceCropInfo * _Nonnull sourceCrop;

视频裁剪信息

ByteRTCPublicStreamLayout

@interface ByteRTCPublicStreamLayout : NSObject

公共流的合流布局

成员变量

类型 名称
NSInteger layoutMode
NSInteger interpolationMode
NSString* backgroundColor
NSString* backgroundImage
NSArray* regions

变量说明

layoutMode

@property(assign, nonatomic) NSInteger layoutMode;

布局模式,目前只支持用户自定义模式,值为 2

interpolationMode

@property(assign, nonatomic) NSInteger interpolationMode;

插帧模式。0: 插入上一帧,!0: 插黑帧

backgroundColor

@property(copy, nonatomic) NSString *_Nonnull backgroundColor;

背景颜色

backgroundImage

@property(copy, nonatomic) NSString *_Nonnull backgroundImage;

背景图片地址

regions

@property(copy, nonatomic) NSArray<ByteRTCPublicStreamRegion *> * _Nonnull regions;

用户布局信息列表

ByteRTCPublicStreamVideoConfig

@interface ByteRTCPublicStreamVideoConfig : NSObject

公共流的视频参数

成员变量

类型 名称
NSInteger width
NSInteger height
NSInteger fps
NSInteger bitrate

变量说明

width

@property(assign, nonatomic) NSInteger width;

视频宽度

height

@property(assign, nonatomic) NSInteger height;

视频高度

fps

@property(assign, nonatomic) NSInteger fps;

视频帧率

bitrate

@property(assign, nonatomic) NSInteger bitrate;

视频码率(kbps)

ByteRTCPublicStreamAudioConfig

@interface ByteRTCPublicStreamAudioConfig : NSObject

公共流视频参数

成员变量

类型 名称
NSInteger sampleRate
NSInteger channels
NSInteger bitrate

变量说明

sampleRate

@property(assign, nonatomic) NSInteger sampleRate;

音频采样率; 16k, 32k, 44.1k, 48k

channels

@property(assign, nonatomic) NSInteger channels;

声道数

bitrate

@property(assign, nonatomic) NSInteger bitrate;

音频码率(kbps); 16kbsp, 32kbps, 64kbps

ByteRTCVideoByteWatermark

@interface ByteRTCVideoByteWatermark: NSObject

水印图片相对视频流的位置和大小。

成员变量

类型 名称
float x
float y
float width
float height

变量说明

x

@property(assign, nonatomic) float x;

水印图片相对视频流左上角的横向偏移与视频流宽度的比值,取值范围为 [0,1)。

y

@property(assign, nonatomic) float y;

水印图片相对视频流左上角的纵向偏移与视频流高度的比值,取值范围为 [0,1)。

width

@property(assign, nonatomic) float width;

水印图片宽度与视频流宽度的比值,取值范围 [0,1)。

height

@property(assign, nonatomic) float height;

水印图片高度与视频流高度的比值,取值范围为 [0,1)。

ByteRTCVideoWatermarkConfig

@interface ByteRTCVideoWatermarkConfig: NSObject

水印参数

成员变量

类型 名称
BOOL visibleInPreview
ByteRTCVideoByteWatermark* positionInLandscapeMode
ByteRTCVideoByteWatermark* positionInPortraitMode

变量说明

visibleInPreview

@property(nonatomic, assign) BOOL visibleInPreview;

水印是否在视频预览中可见,默认可见。

positionInLandscapeMode

@property(strong, nonatomic) ByteRTCVideoByteWatermark * _Nonnull positionInLandscapeMode;

横屏时的水印位置和大小,参看 ByteRTCVideoByteWatermark。

positionInPortraitMode

@property(strong, nonatomic) ByteRTCVideoByteWatermark * _Nonnull positionInPortraitMode;

竖屏时的水印位置和大小,参看 ByteRTCVideoByteWatermark。

ByteRTCPublicStreaming

@interface ByteRTCPublicStreaming : NSObject

公共流参数

成员变量

类型 名称
ByteRTCPublicStreamLayout* layout
ByteRTCPublicStreamVideoConfig* video
ByteRTCPublicStreamAudioConfig* audio
NSString* roomId

静态函数

返回 名称
instancetype defaultPublicStreaming

变量说明

layout

@property(strong, nonatomic) ByteRTCPublicStreamLayout * _Nonnull layout;

用户布局信息,参看 ByteRTCPublicStreamLayout

video

@property(strong, nonatomic) ByteRTCPublicStreamVideoConfig * _Nonnull video;

视频参数。详见 ByteRTCPublicStreamVideoConfig。

audio

@property(strong, nonatomic) ByteRTCPublicStreamAudioConfig * _Nonnull audio;

音频参数。详见 ByteRTCPublicStreamAudioConfig

roomId

@property(copy, nonatomic) NSString * _Nullable roomId;

推公共流的房间ID

函数说明

defaultPublicStreaming

+ (instancetype _Nonnull)defaultPublicStreaming;

获取默认合流参数