@protocol ByteRTCAudioFrameObserver <NSObject>
音频数据回调观察者
| 返回 | 名称 |
|---|---|
| void | onRecordAudioFrame: |
| void | onPlaybackAudioFrame: |
| void | onRemoteUserAudioFrame:audioFrame: |
| void | onMixedAudioFrame: |
- (void)onRecordAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;
返回麦克风录制的音频数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 音频数据, 详见: ByteRTCAudioFrame |
- (void)onPlaybackAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;
返回订阅的所有远端用户混音后的音频数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 音频数据, 详见: ByteRTCAudioFrame |
- (void)onRemoteUserAudioFrame:(ByteRTCRemoteStreamKey * _Nonnull)streamKey audioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;
返回远端单个用户的音频数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息,参看 ByteRTCRemoteStreamKey。 |
| audioFrame | ByteRTCAudioFrame* | 音频数据,参看 ByteRTCAudioFrame。 |
- (void)onMixedAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;
返回本地麦克风录制和订阅的所有远端用户混音后的音频数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 音频数据, 详见: ByteRTCAudioFrame |
@protocol ByteRTCEncryptHandler <NSObject>
自定义加密接口
| 返回 | 名称 |
|---|---|
| NSData* | ByteRTCEncryptRawData: |
| NSData* | ByteRTCDecryptRawData: |
- (NSData * _Nonnull) ByteRTCEncryptRawData:(NSData * _Nonnull)rawData;
自定义加密。
使用设定的自定义加密方式,对传输前的音视频帧数据进行加密。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rawData | NSData* | 原始音视频帧数据 |
返回值 加密后的数据
注意
setCustomizeEncryptHandler:。
- (NSData * _Nonnull) ByteRTCDecryptRawData:(NSData * _Nonnull)rawData;
自定义解密。
对自定义加密后的音视频帧数据进行解密。关于自定义加密,参看 ByteRTCEncryptRawData:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rawData | NSData* | 收到的已加密的音视频帧数据 |
返回值 解密后的数据
注意
setCustomizeEncryptHandler:。@protocol ByteRTCMonitorDelegate <NSObject>
非业务相关的监控事件回调
| 返回 | 名称 |
|---|---|
| void | onMonitorLog:withType: |
| BOOL | isConsole |
| void | onVerboseLogWithLevel:filename:tag:line:functionName:format: |
- (void)onMonitorLog:(NSDictionary * _Nullable)data withType:(NSString * _Nullable)type;
埋点日志回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| data | NSDictionary* | 具体的埋点内容 |
| type | NSString* | 埋点的类型 |
- (BOOL)isConsole;
是否进行控制台输出
返回值 返回是否进行控制台输出
- (void)onVerboseLogWithLevel:(ByteRTCLogLevel)level filename:(NSString * _Nonnull)filename tag:(NSString * _Nonnull)tag line:(int)line functionName:(NSString * _Nonnull)funcName format:(NSString * _Nonnull)format;
输出更多的调试信息
@protocol ByteRTCEngineDelegate <NSObject>
ByteRTCEngineDelegate 协议包含了SDK提供的回调方法,SDK通过代理向应用程序上报一些运行时事件
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onWarning:(ByteRTCWarningCode)Code;
发生警告回调。
SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| Code | ByteRTCWarningCode | 警告代码,参看 ByteRTCWarningCode。 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onError:(ByteRTCErrorCode)errorCode;
发生错误回调。
SDK 运行时出现了网络或媒体相关的错误,且无法自动恢复时触发此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| errorCode | ByteRTCErrorCode | 错误代码,参看 ByteRTCErrorCode。 |
-(void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onAVSyncStateChange:(ByteRTCAVSyncState)state;
发布端调用 setMultiDeviceAVSync: 后音视频同步状态发生改变时,会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| state | ByteRTCAVSyncState | 音视频同步状态,参看 ByteRTCAVSyncState。 |
- (void) rtcEngine:(ByteRTCEngineKit * _Nonnull)engine connectionChangedToState:(ByteRTCConnectionState) state;
SDK 与信令服务器连接状态改变回调。连接状态改变时触发。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| state | ByteRTCConnectionState | 当前 SDK 与信令服务器的连接状态,详见 ByteRTCConnectionState |
- (void) rtcEngine:(ByteRTCEngineKit * _Nonnull)engine networkTypeChangedToType:(ByteRTCNetworkType) type;
SDK 当前网络连接类型改变回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| type | ByteRTCNetworkType | SDK 当前的网络连接类型,详见 ByteRTCNetworkType |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRoomStateChanged:(NSString *_Nonnull)roomId withUid:(nonnull NSString *)uid state:(NSInteger)state extraInfo:(NSString *_Nonnull)extraInfo;
房间状态改变回调,加入房间、离开房间、发生房间相关的警告或错误时会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomId | NSString* | 房间 ID。 |
| uid | NSString* | 用户 ID。 |
| state | NSInteger | 房间状态码。 • 0: 成功。 • !0: 失败,具体原因参看 ByteRTCErrorCode 及 ByteRTCWarningCode。 |
| extraInfo | NSString* | 额外信息。joinType表示加入房间的类型,0为首次进房,1为重连进房。elapsed表示加入房间耗时,即本地用户从调用 joinRoomByKey:roomId:userInfo:rtcRoomConfig: 到加入房间成功所经历的时间间隔,单位为 ms。 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onStreamStateChanged:(NSString *_Nonnull)roomId withUid:(nonnull NSString *)uid state:(NSInteger)state extraInfo:(NSString *_Nonnull)extraInfo;
流状态改变回调,发生流相关的警告或错误时会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomId | NSString* | 房间 ID。 |
| uid | NSString* | 用户 ID。 |
| state | NSInteger | 流状态码,参看 ByteRTCErrorCode 及 ByteRTCWarningCode。 |
| extraInfo | NSString* | 附加信息,目前为空。 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLeaveRoomWithStats:(ByteRTCRoomStats *_Nonnull)stats;
离开房间成功回调。
用户调用 leaveRoom 方法后,SDK 会停止所有的发布订阅流,并释放所有通话相关的音视频资源。SDK 完成所有的资源释放后通过此回调通知用户。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCRoom 对象。 |
| stats | ByteRTCRoomStats* | 本次通话的统计数据,详见 ByteRTCRoomStats 。 |
注意
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onUserJoined:(nonnull ByteRTCUserInfo *)userInfo elapsed:(NSInteger)elapsed;
远端可见用户加入房间,或房内不可见用户切换为可见的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| userInfo | ByteRTCUserInfo* | 用户信息,参看 ByteRTCUserInfo。 |
| elapsed | NSInteger | 保留字段,无意义 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason;
远端用户离开房间,或切至不可见时,本地用户会收到此事件
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 离开房间,或切至不可见的的远端用户 ID。 |
| reason | ByteRTCUserOfflineReason | 用户离开房间的原因: • 0: 远端用户调用 leaveRoom 主动退出房间。 • 1: 远端用户因 Token 过期或网络原因等掉线。 • 2: 远端用户调用 setUserVisibility: 切换至不可见状态。 • 3: 服务端调用 OpenAPI 将远端用户踢出房间。 |
- (void)onTokenWillExpire:(ByteRTCEngineKit * _Nonnull)engine;
Token 过期前 30 秒将触发该回调。
调用 updateToken: 更新 Token。否则 Token 过期后,用户将被移出房间无法继续进行音视频通话。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserStartAudioCapture:(NSString *_Nonnull)userId;
房间内的可见用户调用 startAudioCapture 开启音频采集时,房间内其他用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| userId | NSString* | 开启音频采集的远端用户 ID |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserStopAudioCapture:(NSString *_Nonnull)userId;
房间内的可见用户调用 stopAudioCapture 关闭音频采集时,房间内其他用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| userId | NSString* | 关闭音频采集的远端用户 ID |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstRemoteAudioFrame:(ByteRTCRemoteStreamKey * _Nonnull)key;
当收到远端流的第一帧音频的时候上报该事件
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| key | ByteRTCRemoteStreamKey* | 远端流信息, 详见 ByteRTCRemoteStreamKey |
注意 用户刚收到房间内每一路音频流时,都会收到该回调。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onLocalAudioPropertiesReport:(NSArray<ByteRTCLocalAudioPropertiesInfo *> * _Nonnull)audioPropertiesInfos;
调用 enableAudioPropertiesReport: 后,根据设置的 interval 值,你会周期性地收到此回调,了解本地音频的相关信息。
本地音频包括使用 RTC SDK 内部机制采集的麦克风音频和屏幕音频。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| audioPropertiesInfos | NSArray |
本地音频信息,详见 ByteRTCLocalAudioPropertiesInfo 。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRemoteAudioPropertiesReport:(NSArray<ByteRTCRemoteAudioPropertiesInfo *> * _Nonnull)audioPropertiesInfos totalRemoteVolume:(NSInteger)totalRemoteVolume;
远端用户进房后,本地调用 enableAudioPropertiesReport: ,根据设置的 interval 值,本地会周期性地收到此回调,了解订阅的远端用户的音频信息。
远端用户的音频包括使用 RTC SDK 内部机制/自定义机制采集的麦克风音频和屏幕音频。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| audioPropertiesInfos | NSArray |
远端音频信息,其中包含音频流属性、房间 ID、用户 ID ,详见 ByteRTCRemoteAudioPropertiesInfo。 |
| totalRemoteVolume | NSInteger | 订阅的所有远端流的总音量,范围是 [0,255]。 • [0,25] 接近无声; • [25,75] 为低音量; • [76,204] 为中音量; • [205,255] 为高音量。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onActiveSpeaker:(NSString * _Nonnull)roomId uid:(NSString *_Nonnull)uid;
调用 enableAudioPropertiesReport: 后,根据设置的 config.interval,你会周期性地收到此回调,获取房间内的最活跃用户信息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomId | NSString* | 房间 ID |
| uid | NSString* | 最活跃用户(ActiveSpeaker)的用户 ID |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserStartVideoCapture:(NSString *_Nonnull)userId;
房间内的可见用户调用 startVideoCapture 开启内部视频采集时,房间中其他用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| userId | NSString* | 调用 startVideoCapture 接口的远端用户 ID |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserStopVideoCapture:(NSString *_Nonnull)userId;
房间内的可见用户调用 stopVideoCapture 关闭内部视频采集时,房间内其他用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| userId | NSString* | 关闭视频采集的远端用户 ID |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstLocalVideoFrameCaptured:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo;
第一帧本地采集的视频/屏幕共享画面在本地视图渲染完成时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstRemoteVideoFrameRendered:(ByteRTCRemoteStreamKey * _Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo;
SDK 内部渲染成功远端视频流首帧后,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息,参看 ByteRTCRemoteStreamKey |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstRemoteVideoFrameDecoded:(ByteRTCRemoteStreamKey * _Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo;
SDK 接收并解码远端视频流首帧后,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息,参看 ByteRTCRemoteStreamKey |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRemoteVideoSizeChanged:(ByteRTCRemoteStreamKey *_Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
远端视频大小或旋转信息发生变化时,房间内订阅此视频流的用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamKey | ByteRTCRemoteStreamKey* | 流属性,参看 ByteRTCRemoteStreamKey |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLocalVideoSizeChanged:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
本地视频大小或旋转信息发生变化时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine remoteVideoStateChangedOfUid:(NSString * _Nonnull)uid state:(ByteRTCRemoteVideoState)state;
远端视频流状态发生改变回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象,参考: ByteRTCEngineKit |
| uid | NSString* | 发生视频流状态改变的远端用户的用户ID |
| state | ByteRTCRemoteVideoState | 变更后的远端视频流状态,详见类型 ByteRTCRemoteVideoState |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioDeviceStateChanged:(NSString*_Nonnull)device_id device_type:(ByteRTCAudioDeviceType)device_type device_state:(ByteRTCMediaDeviceState)device_state device_error:(ByteRTCMediaDeviceError)device_error;
音频设备状态回调。提示音频采集、音频播放等设备的状态。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| device_id | NSString* | 设备 ID |
| device_type | ByteRTCAudioDeviceType | 设备类型,参看 ByteRTCAudioDeviceType。 |
| device_state | ByteRTCMediaDeviceState | 设备状态,参看 ByteRTCMediaDeviceState。 |
| device_error | ByteRTCMediaDeviceError | 设备错误类型,参看 ByteRTCMediaDeviceError。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onVideoDeviceStateChanged:(NSString*_Nonnull)device_id device_type:(ByteRTCVideoDeviceType)device_type device_state:(ByteRTCMediaDeviceState)device_state device_error:(ByteRTCMediaDeviceError)device_error;
视频设备状态回调。提示摄像头视频采集、屏幕视频采集等设备的状态。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| device_id | NSString* | 设备 ID |
| device_type | ByteRTCVideoDeviceType | 设备类型,参看 ByteRTCVideoDeviceType。 |
| device_state | ByteRTCMediaDeviceState | 设备状态,参看 ByteRTCMediaDeviceState。 |
| device_error | ByteRTCMediaDeviceError | 设备错误类型,参看 ByteRTCMediaDeviceError。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioDeviceWarning:(NSString*_Nonnull)deviceId deviceType:(ByteRTCAudioDeviceType)deviceType deviceWarning:(ByteRTCMediaDeviceWarning)deviceWarning;
音频设备警告回调。音频设备包括音频采集设备和音频渲染设备。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| deviceId | NSString* | 设备 ID |
| deviceType | ByteRTCAudioDeviceType | 参看 ByteRTCAudioDeviceType |
| deviceWarning | ByteRTCMediaDeviceWarning | 参看 ByteRTCMediaDeviceWarning |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onVideoDeviceWarning:(NSString*_Nonnull)deviceId deviceType:(ByteRTCVideoDeviceType)deviceType deviceWarning:(ByteRTCMediaDeviceWarning)deviceWarning;
视频设备警告回调。视频设备包括视频采集设备。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| deviceId | NSString* | 设备 ID |
| deviceType | ByteRTCVideoDeviceType | 参看 ByteRTCVideoDeviceType |
| deviceWarning | ByteRTCMediaDeviceWarning | 参看 ByteRTCMediaDeviceWarning |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onAudioFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;
音频首帧发送状态改变时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| user | ByteRTCUser* | 本地用户信息,详见 ByteRTCUser |
| state | ByteRTCFirstFrameSendState | 首帧发送状态,详见 ByteRTCFirstFrameSendState |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onVideoFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;
视频首帧发送状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| user | ByteRTCUser* | 本地用户信息,详见 ByteRTCUser |
| state | ByteRTCFirstFrameSendState | 首帧发送状态,详见 ByteRTCFirstFrameSendState |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onScreenVideoFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;
屏幕共享流视频首帧发送状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| user | ByteRTCUser* | 本地用户信息,参看 ByteRTCUser |
| state | ByteRTCFirstFrameSendState | 首帧发送状态,参看 ByteRTCFirstFrameSendState |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onAudioFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;
音频首帧播放状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| user | ByteRTCUser* | 音频流来源的用户信息,参看 ByteRTCUser |
| state | ByteRTCFirstFramePlayState | 首帧播放状态,参看 ByteRTCFirstFramePlayState |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onVideoFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;
视频首帧播放状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| user | ByteRTCUser* | 视频流来源的用户信息,参看 ByteRTCUser |
| state | ByteRTCFirstFramePlayState | 首帧播放状态,参看 ByteRTCFirstFramePlayState |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onScreenVideoFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;
屏幕共享流视频首帧播放状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| user | ByteRTCUser* | 屏幕共享流来源的用户信息,参看 ByteRTCUser |
| state | ByteRTCFirstFramePlayState | 首帧播放状态,参看 ByteRTCFirstFramePlayState |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstLocalAudioFrame:(ByteRTCStreamIndex) streamIndex;
本地采集到第一帧音频帧时,收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamIndex | ByteRTCStreamIndex | 音频流属性, 详见 ByteRTCStreamIndex |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserPublishStream:(NSString *_Nonnull)userId type:(ByteRTCMediaStreamType)type;
房间内新增远端摄像头/麦克风采集的媒体流流的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| userId | NSString* | 远端流发布用户的用户 ID。 |
| type | ByteRTCMediaStreamType | 远端媒体流的类型,参看 ByteRTCMediaStreamType。 |
注意 当房间内的远端用户调用 publishStream: 成功发布由摄像头/麦克风采集的媒体流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStream:mediaStreamType: 订阅此流。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserUnPublishStream:(NSString *_Nonnull)userId type:(ByteRTCMediaStreamType)type reason:(ByteRTCStreamRemoveReason)reason;
房间内远端摄像头/麦克风采集的媒体流移除的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| userId | NSString* | 移除的远端流发布用户的用户 ID。 |
| type | ByteRTCMediaStreamType | 移除的远端流类型,参看 ByteRTCMediaStreamType。 |
| reason | ByteRTCStreamRemoveReason | 远端流移除的原因,参看 ByteRTCStreamRemoveReason。 |
注意 收到该回调通知后,你可以自行选择是否调用 unSubscribeStream:mediaStreamType: 取消订阅此流。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserPublishScreen:(NSString *_Nonnull)userId type:(ByteRTCMediaStreamType)type;
房间内新增远端屏幕共享音视频流的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| userId | NSString* | 远端流发布用户的用户 ID。 |
| type | ByteRTCMediaStreamType | 远端媒体流的类型,参看 ByteRTCMediaStreamType。 |
注意 当房间内的远端用户调用 publishScreen: 成功发布来自屏幕共享的音视频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeScreen:mediaStreamType: 订阅此流。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserUnPublishScreen:(NSString *_Nonnull)userId type:(ByteRTCMediaStreamType)type reason:(ByteRTCStreamRemoveReason)reason;
房间内远端屏幕共享音视频流移除的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例 |
| userId | NSString* | 移除的远端流发布用户的用户 ID。 |
| type | ByteRTCMediaStreamType | 移除的远端流类型,参看 ByteRTCMediaStreamType。 |
| reason | ByteRTCStreamRemoveReason | 远端流移除的原因,参看 ByteRTCStreamRemoveReason。 |
注意 收到该回调通知后,你可以自行选择是否调用 unSubscribeScreen:mediaStreamType: 取消订阅此流。
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onStreamSubscribed:(ByteRTCSubscribeState)state userId:(NSString *_Nonnull)userId subscribeConfig:(ByteRTCSubscribeConfig *_Nonnull)info;
关于订阅媒体流状态改变的回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| state | ByteRTCSubscribeState | 订阅媒体流状态,参看 ByteRTCSubscribeState |
| userId | NSString* | 流发布用户的用户 ID |
| info | ByteRTCSubscribeConfig* | 流的属性,参看 ByteRTCSubscribeConfig |
注意 本地用户收到该回调的时机包括:
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onVideoStreamBanned:(NSString* _Nonnull)uid isBanned:(BOOL)banned;
通过调用服务端 MuteUser/UnmuteUser 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 被禁用/解禁的视频流用户 ID |
| banned | BOOL | 视频流发送状态 • true: 视频流发送被禁用 • false: 视频流发送被解禁 |
注意
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioStreamBanned:(NSString* _Nonnull)uid isBanned:(BOOL)banned;
通过调用服务端 MuteUser/UnmuteUser 方法禁用/解禁指定房间内指定用户视音频流的发送时,触发此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 被禁用/解禁的音频流用户 ID |
| banned | BOOL | 音频流发送状态 • true: 音频流发送被禁用 • false: 音频流发送被解禁 |
注意
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onAudioRouteChanged:(ByteRTCAudioRoute)device;
音频播放路由变化时,收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| device | ByteRTCAudioRoute | 新的音频播放路由,详见 ByteRTCAudioRoute |
注意 关于音频路由设置,详见 setAudioRoute:。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRoomMessageReceived:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message;
收到房间中调用 sendRoomMessage: 发送的广播文本消息时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例。 |
| uid | NSString* | 消息发送者 ID 。 |
| message | NSString* | 收到的文本消息内容。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRoomBinaryMessageReceived:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message;
收到房间中调用 sendRoomBinaryMessage: 发送的广播二进制消息时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例。 |
| uid | NSString* | 消息发送者 ID 。 |
| message | NSData* | 收到的二进制消息内容。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onSEIMessageReceived:(ByteRTCRemoteStreamKey* _Nonnull)remoteStreamKey andMessage:(NSData* _Nonnull)message;
收到通过调用 sendSEIMessage:andMessage:andRepeatCount: 带有 SEI 消息的视频帧时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例。 |
| remoteStreamKey | ByteRTCRemoteStreamKey* | 包含 SEI 发送者的用户名,所在的房间名和媒体流,参看 ByteRTCRemoteStreamKey |
| message | NSData* | 收到的 SEI 消息内容 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onStreamSyncInfoReceived:(ByteRTCRemoteStreamKey* _Nonnull)remoteStreamKey streamType:(ByteRTCSyncInfoStreamType)streamType data:(NSData* _Nonnull)data;
音频流同步信息回调。可以通过此回调,在远端用户调用 sendStreamSyncInfo:config: 发送音频流同步消息后,收到远端发送的音频流同步信息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例。 |
| remoteStreamKey | ByteRTCRemoteStreamKey* | 远端流信息,详见 ByteRTCRemoteStreamKey 。 |
| streamType | ByteRTCSyncInfoStreamType | 媒体流类型,详见 ByteRTCSyncInfoStreamType 。 |
| data | NSData* | 消息内容。 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRoomStats:(ByteRTCRoomStats *_Nonnull)stats;
房间内通话统计信息回调。
用户进房开始通话后,每 2s 收到一次本回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| stats | ByteRTCRoomStats* | 当前 RtcEngine 统计数据,详见 ByteRTCRoomStats |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine reportSysStats:(const ByteRTCSysStats * _Nonnull)stats;
报告当前设备 cpu 与 memory 使用率,每 2s 触发一次。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| stats | const ByteRTCSysStats* | cpu 和 memory 使用率信息,详见 ByteRTCSysStats 数据类型 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLocalStreamStats:(const ByteRTCLocalStreamStats *_Nonnull)stats;
本地流数据统计以及网络质量回调。
本地用户发布流成功后,SDK 会周期性(2s)的通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
统计信息通过 ByteRTCLocalStreamStats 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| stats | const ByteRTCLocalStreamStats* | 发布音/视频流质量以及本地网络质量统计数据,参看 ByteRTCLocalStreamStats 数据类型。 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRemoteStreamStats:(const ByteRTCRemoteStreamStats *_Nonnull)stats;
本地订阅的远端音/视频流数据统计以及网络质量回调。
本地用户订阅流成功后,SDK 会周期性(2s)的通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| stats | const ByteRTCRemoteStreamStats* | 当前 RtcEngine 统计数据,详见 ByteRTCRemoteStreamStats |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLocalAudioStateChanged:(ByteRTCLocalAudioStreamState)state error:(ByteRTCLocalAudioStreamError)error;
本地音频流的状态发生改变时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| state | ByteRTCLocalAudioStreamState | 本地音频设备的当前状态,详见 ByteRTCLocalAudioStreamState |
| error | ByteRTCLocalAudioStreamError | 本地音频流状态改变时的错误码,详见 ByteRTCLocalAudioStreamError |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRemoteAudioStateChanged:(ByteRTCRemoteStreamKey * _Nonnull)key state:(ByteRTCRemoteAudioState)state reason:(ByteRTCRemoteAudioStateChangeReason)reason;
订阅的远端音频流状态发生改变时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| key | ByteRTCRemoteStreamKey* | 远端流信息, 详见 ByteRTCRemoteStreamKey |
| state | ByteRTCRemoteAudioState | 远端音频流的当前状态,详见 ByteRTCRemoteAudioState |
| reason | ByteRTCRemoteAudioStateChangeReason | 远端音频流状态改变的原因,详见 ByteRTCRemoteAudioStateChangeReason |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLocalVideoStateChanged:(ByteRTCStreamIndex)streamIndex withStreamState:(ByteRTCLocalVideoStreamState)state withStreamError:(ByteRTCLocalVideoStreamError)error;
本地视频流的状态发生改变时,收到该事件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex |
| state | ByteRTCLocalVideoStreamState | 本地视频流的当前状态,参看 ByteRTCLocalVideoStreamState |
| error | ByteRTCLocalVideoStreamError | 本地视频状态改变时的错误码,参看 ByteRTCLocalVideoStreamError |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRemoteVideoStateChanged:(ByteRTCRemoteStreamKey*_Nonnull)streamKey withVideoState:(ByteRTCRemoteVideoState)state withVideoStateReason:(ByteRTCRemoteVideoStateChangeReason)reason;
远端视频流的状态发生改变时,房间内订阅此流的用户会收到该事件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamKey | ByteRTCRemoteStreamKey* | 远端视频流信息,房间、用户 ID、流属性等,参看 ByteRTCRemoteStreamKey |
| state | ByteRTCRemoteVideoState | 远端视频流的当前状态,参看 ByteRTCRemoteVideoState |
| reason | ByteRTCRemoteVideoStateChangeReason | 远端视频流状态改变的原因,参看 ByteRTCRemoteVideoStateChangeReason |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageReceived:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message;
收到来自房间中其他用户通过 sendUserMessage:message: 发来的文本消息时(P2P),会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例。 |
| uid | NSString* | 消息发送者的用户 ID 。 |
| message | NSString* | 收到的文本消息内容。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserBinaryMessageReceived:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message;
收到来自房间中其他用户通过 sendUserBinaryMessage:message: 发来的二进制消息时,会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例。 |
| uid | NSString* | 消息发送者的用户 ID 。 |
| message | NSData* | 收到的二进制消息内容。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageSendResult:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error;
向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| msgid | int64_t | 本条消息的 ID。 |
| error | ByteRTCUserMessageSendResult | 消息发送结果,详见 ByteRTCUserMessageSendResult |
注意
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRoomMessageSendResult:(int64_t)msgid error:(ByteRTCRoomMessageSendResult)error;
向房间内所有用户群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| msgid | int64_t | 本条消息的 ID。 |
| error | ByteRTCRoomMessageSendResult | 消息发送结果,详见 ByteRTCRoomMessageSendResult |
注意
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onLoginResult:(NSString * _Nonnull)uid errorCode:(ByteRTCLoginErrorCode)errorCode elapsed:(NSInteger)elapsed;
登录结果回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| uid | NSString* | 登录用户 ID |
| errorCode | ByteRTCLoginErrorCode | 登录结果 详见 ByteRTCLoginErrorCode。 |
| elapsed | NSInteger | 从调用 login:uid: 接口开始到返回结果所用时长。 单位为 ms。 |
注意 调用 login:uid: 后,会收到此回调。
- (void)rtcEngineOnLogout:(ByteRTCEngineKit * _Nonnull)engine;
登出结果回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
注意 调用 logout 后,会收到此回调。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onServerParamsSetResult:(NSInteger)errorCode;
设置应用服务器参数的返回结果
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| errorCode | NSInteger | 设置结果 • 返回 200,设置成功 • 返回其他,设置失败 |
注意 调用 setServerParams:url: 后,会收到此回调。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onGetPeerOnlineStatus:(NSString * _Nonnull)peerUserId status:(ByteRTCUserOnlineStatus)status;
查询对端或本端用户登录状态的返回结果
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| peerUserId | NSString* | 需要查询的用户 ID |
| status | ByteRTCUserOnlineStatus | 查询的用户登录状态 详见 ByteRTCUserOnlineStatus. |
注意 必须先调用 getPeerOnlineStatus:,才能收到此回调。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageReceivedOutsideRoom:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message;
收到房间外用户调用 sendUserMessageOutsideRoom:message: 发来的文本消息时,会收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| uid | NSString* | 消息发送者 ID |
| message | NSString* | 收到的文本消息内容 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserBinaryMessageReceivedOutsideRoom:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message;
收到房间外用户调用 sendUserBinaryMessageOutsideRoom:message: 发来的二进制消息时,会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| uid | NSString* | 消息发送者 ID |
| message | NSData* | 收到的二进制消息内容 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageSendResultOutsideRoom:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error;
给房间外指定的用户发送消息的回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| msgid | int64_t | 本条消息的 ID 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 |
| error | ByteRTCUserMessageSendResult | 消息发送结果 详见 ByteRTCUserMessageSendResult。 |
注意 当调用 sendUserMessageOutsideRoom:message: 或 sendUserBinaryMessageOutsideRoom:message: 发送消息后,会收到此回调。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onServerMessageSendResult:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error message:(NSData * _Nonnull)message;
给应用服务器发送消息的回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| msgid | int64_t | 本条消息的 ID 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 |
| error | ByteRTCUserMessageSendResult | 消息发送结果,详见 ByteRTCUserMessageSendResult。 |
| message | NSData* | 应用服务器收到 HTTP 请求后,在 ACK 中返回的信息。 |
注意 当调用 sendServerMessage: 或 sendServerBinaryMessage: 接口发送消息后,会收到此回调。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onNetworkDetectionResult:(ByteRTCNetworkDetectionLinkType)type quality:(ByteRTCNetworkQuality)quality rtt:(int)rtt lostRate:(double)lost_rate bitrate:(int)bitrate jitter:(int)jitter;
通话前网络探测结果
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| type | ByteRTCNetworkDetectionLinkType | 探测网络类型为上行/下行 |
| quality | ByteRTCNetworkQuality | 探测网络的质量,值含义参考 ByteRTCNetworkQuality |
| rtt | int | 探测网络的 RTT,单位:ms |
| lost_rate | double | 探测网络的丢包率 |
| bitrate | int | 探测网络的带宽,单位:kbps |
| jitter | int | 探测网络的抖动,单位:ms |
注意 成功调用 startNetworkDetection:uplinkBandwidth:downlink:downlinkBandwidth: 接口开始探测后,会每 2s 收到一次此回调。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onNetworkDetectionStopped:(ByteRTCNetworkDetectionStopReason)err_code;
通话前网络探测结束
以下情况将停止探测并收到本一次本回调:
1. 当调用 stopNetworkDetection 接口停止探测后,会收到一次该回调;
2. 当收到远端/本端音频首帧后,停止探测;
3. 当探测超过3分钟后,停止探测;
4. 当探测链路断开一定时间之后,停止探测。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| err_code | ByteRTCNetworkDetectionStopReason | 停止探测的原因类型,参考 ByteRTCNetworkDetectionStopReason |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioMixingStateChanged:(NSInteger)mixId state:(ByteRTCAudioMixingState)state error:(ByteRTCAudioMixingError)error;
音频混音文件播放状态改变时回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTC SDK 对象 |
| mixId | NSInteger | 混音 ID 使用 ByteRTCAudioMixingManager 相关接口时传入的唯一 ID。 |
| state | ByteRTCAudioMixingState | 混音状态 其混音状态可参考:ByteRTCAudioMixingState。 |
| error | ByteRTCAudioMixingError | 错误码 详见 ByteRTCAudioMixingError。 |
注意
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioMixingPlayingProgress:(NSInteger)mixId progress:(int64_t) progress;
混音音频文件播放进度回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTC SDK 对象 |
| mixId | NSInteger | 混音 ID |
| progress | int64_t | 当前混音音频文件播放进度,单位毫秒 |
注意 调用 setAudioMixingProgressInterval:interval: 将时间间隔设为大于 0 的值后,或调用 startAudioMixing:filePath:config: 将 ByteRTCAudioMixingConfig 中的时间间隔设为大于 0 的值后,SDK 会按照设置的时间间隔回调该事件。
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onPerformanceAlarmsWithMode:(ByteRTCPerformanceAlarmMode)mode roomId:(NSString *_Nonnull)roomId reason:(ByteRTCPerformanceAlarmReason)reason sourceWantedData:(ByteRTCSourceWantedData *_Nonnull)data;
本地未开启发布性能回退,检测到设备性能不足时,收到此回调。
本地开启发布性能回退,因设备性能/网络原因,造成发布性能回退/恢复时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mode | ByteRTCPerformanceAlarmMode | 指示本地是否开启发布回退功能。参看 ByteRTCPerformanceAlarmMode • 当发布端未开启发布性能回退时,mode 值为 ByteRTCPerformanceAlarmModeNormal。 • 当发布端开启发布性能回退时,mode 值为 ByteRTCPerformanceAlarmModeSimulcast。 |
| roomId | NSString* | • 未开启发布性能回退时,roomId 为空 • 开启发布性能回退时,roomId 是告警影响的房间 ID。 |
| reason | ByteRTCPerformanceAlarmReason | 告警原因,参看 ByteRTCPerformanceAlarmReason |
| data | ByteRTCSourceWantedData* | 性能回退相关数据,详见 ByteRTCSourceWantedData。 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine OnSimulcastSubscribeFallback:(ByteRTCRemoteStreamSwitchEvent *_Nonnull)event;
因发布/订阅性能回退或退出回退状态,订阅的音视频流,发生流的切换时,收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例 |
| event | ByteRTCRemoteStreamSwitchEvent* | 流切换信息。详见 ByteRTCRemoteStreamSwitchEvent。 |
注意
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onHttpProxyState:(NSInteger)state;
HTTP 代理连接状态改变时,收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| state | NSInteger | 当前 HTTP 代理连接状态 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onHttpsProxyState:(NSInteger)state;
HTTPS 代理连接状态改变时,收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| state | NSInteger | 当前 HTTPS 代理连接状态 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onSocks5ProxyState:(NSInteger)state cmd:(NSString *_Nonnull)cmd proxy_address:(NSString *_Nonnull)proxy_address local_address:(NSString *_Nonnull)local_address remote_address:(NSString *_Nonnull)remote_address;
SOCKS5 代理状态改变时,收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| state | NSInteger | SOCKS5 代理连接状态 |
| cmd | NSString* | 代理连接的每一步操作命令 |
| proxy_address | NSString* | 代理地址信息 |
| local_address | NSString* | 当前连接使用的本地地址 |
| remote_address | NSString* | 远端的连接地址 |
- (void)rtcEngine:(ByteRTCEngineKit* _Nonnull)engine onRecordingStateUpdate:(ByteRTCStreamIndex)type state:(ByteRTCRecordingState)state error_code:(ByteRTCRecordingErrorCode)error_code recording_info:(ByteRTCRecordingInfo* _Nonnull)recording_info;
获取本地录制状态回调。
该回调由 startFileRecording:withRecordingConfig:type: 或 stopFileRecording: 触发。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| type | ByteRTCStreamIndex | 录制流的流属性,参看 ByteRTCStreamIndex |
| state | ByteRTCRecordingState | 录制状态,参看 ByteRTCRecordingState |
| error_code | ByteRTCRecordingErrorCode | 录制错误码,参看 ByteRTCRecordingErrorCode |
| recording_info | ByteRTCRecordingInfo* | 录制文件的详细信息,参看 ByteRTCRecordingInfo |
- (void)rtcEngine:(ByteRTCEngineKit* _Nonnull)engine onRecordingProgressUpdate:(ByteRTCStreamIndex)type process:(ByteRTCRecordingProgress* _Nonnull)process recording_info:(ByteRTCRecordingInfo* _Nonnull)recording_info;
本地录制进度回调。
该回调由 startFileRecording:withRecordingConfig:type: 触发,录制状态正常时,系统每秒钟都会通过该回调提示录制进度。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| type | ByteRTCStreamIndex | 录制流的流属性,参看 ByteRTCStreamIndex |
| process | ByteRTCRecordingProgress* | 录制进度,参看 ByteRTCRecordingProgress |
| recording_info | ByteRTCRecordingInfo* | 录制文件的详细信息,参看 ByteRTCRecordingInfo |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onForwardStreamStateChanged:(NSArray<ForwardStreamStateInfo *> * _Nonnull)infos;
跨房间媒体流转发状态和错误回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit object |
| infos | NSArray |
跨房间媒体流转发目标房间信息数组,详见 ForwardStreamStateInfo |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onForwardStreamEvent:(NSArray<ForwardStreamEventInfo *> * _Nonnull)infos;
跨房间媒体流转发事件回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| infos | NSArray |
跨房间媒体流转发目标房间事件数组,详见 ForwardStreamEventInfo |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onNetworkQuality:(ByteRTCNetworkQualityStats *)localQuality remoteQualities:(NSArray<ByteRTCNetworkQualityStats*> *)remoteQualities;
网络质量回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| localQuality | ByteRTCNetworkQualityStats* | 本端网络质量,详见 ByteRTCNetworkQualityStats。 |
| remoteQualities | NSArray |
已订阅用户的网络质量,详见 ByteRTCNetworkQualityStats。 |
注意 更多通话中的监测接口,详见通话中质量监测
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onPushPublicStreamResult:(NSString *_Nonnull)publicStreamId errorCode:(int)errorCode;
公共流发布结果回调。
调用 startPushPublicStream:withLayout:
接口或直接在服务端启动推公共流功能后,你会通过此回调收到启动结果和推流过程中的错误。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | engine 实例 |
| publicStreamId | NSString* | 公共流ID。 |
| errorCode | int | 公共流发布结果状态码。 ByteRTCTranscodingError。 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onPlayPublicStreamResult:(NSString *_Nonnull)publicStreamId errorCode:(int)errorCode;
订阅公共流的结果回调
调用 startPlayPublicStream: 接口拉公共流后,你会通过此回调收到启动结果和拉流过程中的错误。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | engine 实例 |
| publicStreamId | NSString* | 公共流ID。 |
| errorCode | int | 公共流订阅结果状态码。详见枚举类型 ByteRTCTranscodingError。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onPublicStreamSEIMessageReceived:(NSString* _Nonnull)publicStreamId andMessage:(NSData* _Nonnull)message;
回调公共流中包含的 SEI 信息
通过 startPlayPublicStream: 开始播放公共流后,可以通过本回调获取公共流中包含的 SEI 信息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 实例。 |
| publicStreamId | NSString* | 公共流ID |
| message | NSData* | 收到的 SEI 消息内容 |
注意 当公共流中的多路视频流均包含有 SEI 信息时:SEI 不互相冲突时,将通过多次回调分别发送; SEI 在同一帧有冲突时,则只有一条流中的 SEI 信息被透传并融合到公共流中。
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstPublicStreamVideoFrameDecoded:(NSString * _Nonnull)publicStreamId withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo;
公共流的首帧视频解码成功
关于订阅公共流,详见 startPlayPublicStream:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| publicStreamId | NSString* | 公共流 ID |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstPublicStreamAudioFrame:(NSString * _Nonnull)publicStreamId;
公共流的音频首帧解码成功
关于订阅公共流,详见 startPlayPublicStream:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| publicStreamId | NSString* | 公共流 ID |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onCloudProxyConnected:(NSInteger)interval;
调用 startCloudProxy: 开启云代理,SDK 首次成功连接云代理服务器时,回调此事件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| interval | NSInteger | 从开启云代理到连接成功经过的时间,单位为 ms |
@protocol ByteRTCRangeAudioObserver <NSObject>
范围语音衰减系数监测器
| 返回 | 名称 |
|---|---|
| void | onRangeAudioInfo: |
- (void)onRangeAudioInfo:(NSArray<ByteRTCRangeAudioInfo *> * _Nonnull)rangeAudioInfo;
关于当前范围语音衰减系数的回调。
手动订阅的场景下,房间内任一用户调用 updatePosition: 更新自身位置或调用 updateReceiveRange: 更新语音接收范围时,该用户与房间内其他用户的相对距离都会发生改变,据此计算的衰减系数也会发生改变,并通过该回调通知用户。
你可以通过关注该回调中包含的远端用户的衰减系数决定是否订阅该远端用户的流。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rangeAudioInfo | NSArray |
包含范围语音流信息的数组,参看 ByteRTCRangeAudioInfo |
注意 更新自身位置或语音接收范围后,并不会马上触发该回调。SDK 会每 500 ms 计算一次衰减系数,并且只在计算结果与上次不同,或结果相同但是距离上次计算已超过 3 秒的时候推送回调。
@protocol ByteRTCVideoFrameObserver <NSObject>
| 返回 | 名称 |
|---|---|
| void | onLocalScreenFrame: |
| void | onLocalVideoFrame: |
| void | onRemoteScreenFrame:user:room: |
| void | onRemoteVideoFrame:user:room: |
- (void)onLocalScreenFrame:(ByteRTCVideoFrame * _Nonnull)frame;
本地屏幕流的视频帧数据回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| frame | ByteRTCVideoFrame* | 本地屏幕视频帧数据,参考: ByteRTCVideoFrame |
- (void)onLocalVideoFrame:(ByteRTCVideoFrame * _Nonnull)frame;
本地视频流的视频帧数据回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| frame | ByteRTCVideoFrame* | 本地视频流的视频帧数据,参考: ByteRTCVideoFrame |
- (void)onRemoteScreenFrame:(ByteRTCVideoFrame * _Nonnull)frame user:(NSString * _Nullable)uid room:(NSString * _Nullable)room;
远端屏幕流的视频帧数据回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| frame | ByteRTCVideoFrame* | 远端屏幕的视频帧数据,参考: ByteRTCVideoFrame |
| uid | NSString* | 远端屏幕共享用户ID |
| room | NSString* | 对应流的房间 id |
- (void)onRemoteVideoFrame:(ByteRTCVideoFrame * _Nonnull)frame user:(NSString * _Nullable)uid room:(NSString * _Nullable)room;
远端视频流的视频帧数据回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| frame | ByteRTCVideoFrame* | 远端视频流的视频帧数据,参考: ByteRTCVideoFrame |
| uid | NSString* | 远端屏幕共享用户ID |
| room | NSString* | 对应流的房间 id |
@protocol ByteRTCVideoProcessorDelegate <NSObject>
| 返回 | 名称 |
|---|---|
| ByteRTCVideoFrame* | processVideoFrame: |
- (ByteRTCVideoFrame* _Nullable) processVideoFrame:(ByteRTCVideoFrame* _Nonnull)src_frame;
获取 RTC SDK 采集得到的视频帧,根据 registerLocalVideoProcessor:withConfig: 设置的视频前处理器,进行视频前处理,最终将处理后的视频帧给到 RTC SDK 用于编码传输。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| src_frame | ByteRTCVideoFrame* | RTC SDK 采集得到的视频帧,参考: ByteRTCVideoFrame |
返回值 经过视频前处理后的视频帧,返回给 RTC SDK 供编码和传输,参考: ByteRTCVideoFrame
注意 如果需要取消视频前处理,可以将视频前处理器设置为 nullptr。
@protocol ByteRTCLocalEncodedVideoFrameObserver<NSObject>
本地视频帧监测器
| 返回 | 名称 |
|---|---|
| void | onLocalEncodedVideoFrame:Frame: |
- (void)onLocalEncodedVideoFrame:(ByteRTCStreamIndex) streamIndex Frame:(ByteRTCEncodedVideoFrame * _Null_unspecified)frame;
调用 registerLocalEncodedVideoFrameObserver: 后,SDK 每次使用内部采集,采集到一帧视频帧,或收到一帧外部视频帧时,都会回调该事件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 本地视频帧类型,参看 ByteRTCStreamIndex |
| frame | ByteRTCEncodedVideoFrame* _Null_unspecified | 本地视频帧信息,参看 ByteRTCEncodedVideoFrame |
@protocol ByteRTCExternalVideoEncoderEventHandler<NSObject>
自定义编码帧回调类
| 返回 | 名称 |
|---|---|
| void | onStart: |
| void | onStop: |
| void | onRateUpdate:withVideoIndex:withFps:withBitRate: |
| void | onRequestKeyFrame:withVideoIndex: |
- (void)onStart:(ByteRTCStreamIndex)streamIndex;
提示自定义编码帧可以开始推送的回调。
收到该回调后,你即可调用 pushExternalEncodedVideoFrame:withVideoIndex:withEncodedVideoFrame: 向 SDK 推送自定义编码视频帧
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 可以推送的编码流的属性,参看 ByteRTCStreamIndex |
- (void)onStop:(ByteRTCStreamIndex)streamIndex;
当收到该回调时,你需停止向 SDK 推送自定义编码视频帧
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 需停止推送的编码流的属性,参看 ByteRTCStreamIndex |
- (void)onRateUpdate:(ByteRTCStreamIndex)streamIndex withVideoIndex:(NSInteger)videoIndex withFps:(NSInteger)fps withBitRate:(NSInteger)bitRateKps;
当自定义编码流的帧率或码率发生变化时,触发该回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 发生变化的编码流的属性,参看 ByteRTCStreamIndex |
| videoIndex | NSInteger | 对应编码流的下标 |
| fps | NSInteger | 变化后的帧率,单位:fps |
| bitRateKps | NSInteger | 变化后的码率,单位:kbps |
- (void)onRequestKeyFrame:(ByteRTCStreamIndex)streamIndex withVideoIndex:(NSInteger)videoIndex;
提示流发布端需重新生成关键帧的回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 远端编码流的属性,参看 ByteRTCStreamIndex |
| videoIndex | NSInteger | 对应编码流的下标 |
@protocol ByteRTCRemoteEncodedVideoFrameObserver<NSObject>
远端编码后视频数据监测器
| 返回 | 名称 |
|---|---|
| void | onRemoteEncodedVideoFrame:withEncodedVideoFrame: |
- (void)onRemoteEncodedVideoFrame:(ByteRTCRemoteStreamKey * _Nonnull)streamKey withEncodedVideoFrame:(ByteRTCEncodedVideoFrame* _Nonnull)videoFrame;
调用 registerRemoteEncodedVideoFrameObserver: 后,SDK 监测到远端编码后视频数据时,触发该回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamKey | ByteRTCRemoteStreamKey* | 收到的远端流信息,参看 ByteRTCRemoteStreamKey |
| videoFrame | ByteRTCEncodedVideoFrame* | 收到的远端视频帧信息,参看 ByteRTCEncodedVideoFrame |
@protocol LiveTranscodingDelegate <NSObject>
转推直播观察者。
| 返回 | 名称 |
|---|---|
| BOOL | isSupportClientPushStream |
| void | onStreamMixingEvent:taskId:error:mixType: |
| void | onMixingAudioFrame:taskId: |
| void | onMixingVideoFrame:taskId: |
| void | onMixingDataFrame:taskId: |
- (BOOL)isSupportClientPushStream;
是否具有推流能力。
注意
- (void)onStreamMixingEvent:(ByteRTCStreamMixingEvent)event taskId:(NSString *_Nonnull)taskId error:(ByteRtcTranscoderErrorCode)Code mixType:(ByteRTCStreamMixingType)mixType;
转推直播状态回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| event | ByteRTCStreamMixingEvent | 转推直播任务状态,参看 ByteRTCStreamMixingEvent。 |
| taskId | NSString* | 转推直播任务 ID。 |
| Code | ByteRtcTranscoderErrorCode | 转推直播错误码,参看 ByteRtcTranscoderErrorCode 和 ByteRTCTranscodingError。 |
| mixType | ByteRTCStreamMixingType | 转推直播类型,参看 ByteRTCStreamMixingType。 |
- (void)onMixingAudioFrame:(ByteRTCAudioFrame *_Nonnull)audioFrame taskId:(NSString *_Nonnull)taskId;
端云一体合流音频 PCM 回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | PCM 编码的合流音频数据帧,参看 ByteRTCAudioFrame。 |
| taskId | NSString* | 转推直播任务 ID。 |
注意 收到该回调的周期为每 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。
- (void)onMixingVideoFrame:(ByteRTCVideoFrame *_Nonnull)videoFrame taskId:(NSString *_Nonnull)taskId;
端云一体合流视频 YUV 回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| videoFrame | ByteRTCVideoFrame* | YUV 合流视频数据帧,参看 ByteRTCVideoFrame。 |
| taskId | NSString* | 转推直播任务 ID。 |
注意 收到该回调的周期取决于视频的帧率。
- (void)onMixingDataFrame:(ByteRTCFrameExtendedData *_Nonnull)dataFrame taskId:(NSString *_Nonnull)taskId;
端云一体合流视频 SEI 数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| dataFrame | ByteRTCFrameExtendedData* | SEI 数据,详见 ByteRTCFrameExtendedData。 |
| taskId | NSString* | 转推直播任务 ID。 |
@protocol ByteRTCFaceDetectionObserver <NSObject>
人脸检测结果回调观察者
| 返回 | 名称 |
|---|---|
| void | onFaceDetectionResult: |
- (void)onFaceDetectionResult:(ByteRTCFaceDetectionResult * _Nonnull)result;
特效 SDK 进行人脸检测结果的回调。
调用 registerFaceDetectionObserver:withInterval: 注册了 ByteRTCFaceDetectionObserver ,并使用 RTC SDK 中包含的特效 SDK 进行视频特效处理时,你会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| result | ByteRTCFaceDetectionResult* | 人脸检测结果, 参看 ByteRTCFaceDetectionResult。 |
@protocol ByteRTCRoomDelegate <NSObject>
房间事件回调接口
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomStateChanged:(NSString *_Nonnull)roomId withUid:(nonnull NSString *)uid state:(NSInteger)state extraInfo:(NSString *_Nonnull)extraInfo;
房间状态改变回调,加入房间、离开房间、发生房间相关的警告或错误时会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomId | NSString* | 房间 ID。 |
| uid | NSString* | 用户 ID。 |
| state | NSInteger | 房间状态码。 • 0: 成功。 • !0: 失败,具体原因参看 ByteRTCErrorCode 及 ByteRTCWarningCode。 |
| extraInfo | NSString* | 额外信息。joinType表示加入房间的类型,0为首次进房,1为重连进房。elapsed表示加入房间耗时,即本地用户从调用 joinRoomByToken:userInfo:roomConfig: 到加入房间成功所经历的时间间隔,单位为 ms。 |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onStreamStateChanged:(NSString *_Nonnull)roomId withUid:(nonnull NSString *)uid state:(NSInteger)state extraInfo:(NSString *_Nonnull)extraInfo;
流状态改变回调,发生流相关的警告或错误时会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomId | NSString* | 房间 ID。 |
| uid | NSString* | 用户 ID。 |
| state | NSInteger | 流状态码,参看 ByteRTCErrorCode 及 ByteRTCWarningCode。 |
| extraInfo | NSString* | 附加信息,目前为空。 |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onAVSyncStateChange:(ByteRTCAVSyncState)state;
发布端调用 setMultiDeviceAVSync: 后音视频同步状态发生改变时,会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 实例 |
| state | ByteRTCAVSyncState | 音视频同步状态,参看 ByteRTCAVSyncState。 |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomStats:(ByteRTCRoomStats *_Nonnull)stats;
房间内通话统计信息回调。
用户进房开始通话后,每 2s 收到一次本回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| stats | ByteRTCRoomStats* | 当前 ByteRTCRoom 统计数据,详见:ByteRTCRoomStats |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onLocalStreamStats:(ByteRTCLocalStreamStats *_Nonnull)stats;
本地流数据统计以及网络质量回调。
本地用户发布流成功后,SDK 会周期性(2s)的通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
统计信息通过 ByteRTCLocalStreamStats 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| stats | ByteRTCLocalStreamStats* | 当前房间本地流数据统计。详见:ByteRTCLocalStreamStats |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRemoteStreamStats:(ByteRTCRemoteStreamStats *_Nonnull)stats;
本地订阅的远端音/视频流数据统计以及网络质量回调。
本地用户订阅流成功后,SDK 会周期性(2s)的通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| stats | ByteRTCRemoteStreamStats* | 当前房间本地流数据统计。 详见:ByteRTCRemoteStreamStats |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserJoined:(ByteRTCUserInfo *_Nonnull)userInfo elapsed:(NSInteger)elapsed;
远端可见用户加入房间,或房内隐身用户切换为可见的回调。
1. 远端用户调用 setUserVisibility: 方法将自身设为可见后加入房间时,房间内其他用户将收到该事件。
2. 远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
3. 房间内隐身远端用户调用 setUserVisibility: 方法切换至可见时,房间内其他用户将收到该事件。
4. 新进房用户会收到进房前已在房内的主播角色用户的进房回调通知。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| userInfo | ByteRTCUserInfo* | 用户信息,参看 ByteRTCUserInfo。 |
| elapsed | NSInteger | 保留字段,无意义 |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason;
远端用户离开房间,或切至不可见时,本地用户会收到此事件
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 离开房间,或切至不可见的的远端用户 ID。 |
| reason | ByteRTCUserOfflineReason | 用户离开房间的原因: • 0: 远端用户调用 leaveRoom 主动退出房间。 • 1: 远端用户因 Token 过期或网络原因等掉线。 • 2: 远端用户调用 setUserVisibility: 切换至不可见状态。 • 3: 服务端调用 OpenAPI 将远端用户踢出房间。 |
- (void)onTokenWillExpire:(ByteRTCRoom *_Nonnull)rtcRoom;
Token 过期前 30 秒将触发该回调。
调用 updateToken: 更新 Token。否则 Token 过期后,用户将被移出房间无法继续进行音视频通话。
- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onUserStartAudioCapture:(NSString *_Nonnull)userId;
房间内的用户调用 startAudioCapture 开启音频采集时,房间内其他用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 实例 |
| userId | NSString* | 开启音频采集的远端用户 ID |
- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onUserStopAudioCapture:(NSString *_Nonnull)userId;
房间内的用户调用 stopAudioCapture 关闭音频采集时,房间内其他用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 实例 |
| userId | NSString* | 关闭音频采集的远端用户 ID |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstLocalAudioFrame:(ByteRTCStreamIndex) streamIndex;
本地采集到第一帧音频帧时,收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| streamIndex | ByteRTCStreamIndex | 音频流属性, 详见 ByteRTCStreamIndex |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstRemoteAudioFrame:(ByteRTCRemoteStreamKey * _Nonnull)key;
当收到远端流的第一帧音频的时候上报该事件
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| key | ByteRTCRemoteStreamKey* | 远端流信息, 详见 ByteRTCRemoteStreamKey |
注意 用户刚收到房间内每一路音频流时,都会收到该回调。
- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onUserPublishStream:(NSString *_Nonnull)userId type:(ByteRTCMediaStreamType)type;
房间内新增远端摄像头/麦克风采集的媒体流流的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 实例 |
| userId | NSString* | 远端流发布用户的用户 ID。 |
| type | ByteRTCMediaStreamType | 远端媒体流的类型,参看 ByteRTCMediaStreamType。 |
注意 当房间内的远端用户调用 publishStream: 成功发布由摄像头/麦克风采集的媒体流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStream:mediaStreamType: 订阅此流。
- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onUserUnPublishStream:(NSString *_Nonnull)userId type:(ByteRTCMediaStreamType)type reason:(ByteRTCStreamRemoveReason)reason;
房间内远端摄像头/麦克风采集的媒体流移除的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 实例 |
| userId | NSString* | 移除的远端流发布用户的用户 ID。 |
| type | ByteRTCMediaStreamType | 移除的远端流类型,参看 ByteRTCMediaStreamType。 |
| reason | ByteRTCStreamRemoveReason | 远端流移除的原因,参看 ByteRTCStreamRemoveReason。 |
注意 收到该回调通知后,你可以自行选择是否调用 unSubscribeStream:mediaStreamType: 取消订阅此流。
- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onUserPublishScreen:(NSString *_Nonnull)userId type:(ByteRTCMediaStreamType)type;
房间内新增远端屏幕共享音视频流的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom实例 |
| userId | NSString* | 远端流发布用户的用户 ID。 |
| type | ByteRTCMediaStreamType | 远端媒体流的类型,参看 ByteRTCMediaStreamType。 |
注意 当房间内的远端用户调用 publishScreen: 成功发布来自屏幕共享的音视频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeScreen:mediaStreamType: 订阅此流。
- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onUserUnPublishScreen:(NSString *_Nonnull)userId type:(ByteRTCMediaStreamType)type reason:(ByteRTCStreamRemoveReason)reason;
房间内远端屏幕共享音视频流移除的回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 实例 |
| userId | NSString* | 移除的远端流发布用户的用户 ID。 |
| type | ByteRTCMediaStreamType | 移除的远端流类型,参看 ByteRTCMediaStreamType。 |
| reason | ByteRTCStreamRemoveReason | 远端流移除的原因,参看 ByteRTCStreamRemoveReason。 |
注意 收到该回调通知后,你可以自行选择是否调用 unSubscribeScreen:mediaStreamType: 取消订阅此流。
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onStreamSubscribed:(ByteRTCSubscribeState)state userId:(NSString *_Nonnull)userId subscribeConfig:(ByteRTCSubscribeConfig *_Nonnull)info;
关于订阅媒体流状态改变的回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象 |
| state | ByteRTCSubscribeState | 订阅媒体流状态,参看 ByteRTCSubscribeState |
| userId | NSString* | 流发布用户的用户 ID |
| info | ByteRTCSubscribeConfig* | 流的属性,参看 ByteRTCSubscribeConfig |
注意 本地用户收到该回调的时机包括:
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageReceived:(NSString *_Nonnull)uid message:(NSString *_Nonnull)message;
收到房间中调用 sendRoomMessage: 发送的广播文本消息时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象 |
| uid | NSString* | 消息发送者 ID 。 |
| message | NSString* | 收到的文本消息内容。 |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomBinaryMessageReceived:(NSString *_Nonnull)uid message:(NSData *_Nonnull)message;
收到房间中调用 sendRoomBinaryMessage: 发送的广播二进制消息时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象 |
| uid | NSString* | 消息发送者 ID 。 |
| message | NSData* | 收到的二进制消息内容。 |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserMessageReceived:(NSString *_Nonnull)uid message:(NSString *_Nonnull)message;
收到来自房间中其他用户通过 sendUserMessage:message: 发来的文本消息时(P2P),会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象 |
| uid | NSString* | 消息发送者的用户 ID 。 |
| message | NSString* | 收到的文本消息内容。 |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserBinaryMessageReceived:(NSString *_Nonnull)uid message:(NSData *_Nonnull)message;
收到来自房间中其他用户通过 sendUserBinaryMessage:message: 发来的二进制消息时,会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象 |
| uid | NSString* | 消息发送者的用户 ID 。 |
| message | NSData* | 收到的二进制消息内容。 |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserMessageSendResult:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error;
向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| msgid | int64_t | 本条消息的 ID。 |
| error | ByteRTCUserMessageSendResult | 消息发送结果,详见 ByteRTCUserMessageSendResult |
注意
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageSendResult:(int64_t)msgid error:(ByteRTCRoomMessageSendResult)error;
向房间内所有用户群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| msgid | int64_t | 本条消息的 ID。 |
| error | ByteRTCRoomMessageSendResult | 消息发送结果,详见 ByteRTCRoomMessageSendResult |
注意
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstLocalVideoFrameCaptured:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
第一帧本地采集的视频/屏幕共享画面在本地视图渲染完成时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onLocalVideoSizeChanged:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
本地视频大小或旋转信息发生变化时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRemoteVideoSizeChanged:(ByteRTCRemoteStreamKey *_Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
远端视频大小或旋转配置发生改变时,房间内订阅此视频流的用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息。参看 ByteRTCRemoteStreamKey |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息。参看 ByteRTCVideoFrameInfo |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstRemoteVideoFrameRendered:(ByteRTCRemoteStreamKey *_Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
SDK 内部渲染成功远端视频流首帧后,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息,参看 ByteRTCRemoteStreamKey |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstRemoteVideoFrameDecoded:(ByteRTCRemoteStreamKey *_Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
SDK 接收并解码远端视频流首帧后,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息,参看 ByteRTCRemoteStreamKey |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserStartVideoCapture:(NSString *_Nonnull)userId;
房间内的可见用户调用 startVideoCapture 开启内部视频采集时,房间中其他用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 实例 |
| userId | NSString* | 调用 startVideoCapture 接口的远端用户 ID |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserStopVideoCapture:(NSString *_Nonnull)uid;
房间内的可见用户调用 stopVideoCapture 时,本地用户将会收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 实例 |
| uid | NSString* | 关闭视频采集的远端用户 ID |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onLocalAudioStateChanged:(ByteRTCLocalAudioStreamState)state error:(ByteRTCLocalAudioStreamError)error;
本地音频流的状态发生改变时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| state | ByteRTCLocalAudioStreamState | 本地音频设备的当前状态,详见 ByteRTCLocalAudioStreamState |
| error | ByteRTCLocalAudioStreamError | 本地音频流状态改变时的错误码,详见 ByteRTCLocalAudioStreamError |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRemoteAudioStateChanged:(ByteRTCRemoteStreamKey * _Nonnull)key state:(ByteRTCRemoteAudioState)state reason:(ByteRTCRemoteAudioStateChangeReason)reason;
订阅的远端音频流状态发生改变时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| key | ByteRTCRemoteStreamKey* | 远端流信息, 详见 ByteRTCRemoteStreamKey |
| state | ByteRTCRemoteAudioState | 远端音频流的当前状态,详见 ByteRTCRemoteAudioState |
| reason | ByteRTCRemoteAudioStateChangeReason | 远端音频流状态改变的原因,详见 ByteRTCRemoteAudioStateChangeReason |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onLocalVideoStateChanged:(ByteRTCStreamIndex)streamIndex withStreamState:(ByteRTCLocalVideoStreamState)state withStreamError:(ByteRTCLocalVideoStreamError)error;
本地视频流的状态发生改变时,收到该事件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex |
| state | ByteRTCLocalVideoStreamState | 本地视频流的当前状态,详见 ByteRTCLocalVideoStreamState |
| error | ByteRTCLocalVideoStreamError | 本地视频状态改变时的错误码,详见 ByteRTCLocalVideoStreamError |
- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onRemoteVideoStateChanged:(ByteRTCRemoteStreamKey * _Nonnull)streamKey withVideoState:(ByteRTCRemoteVideoState)state withVideoStateReason:(ByteRTCRemoteVideoStateChangeReason)reason;
远端视频流的状态发生改变时,房间内订阅此流的用户会收到该事件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| streamKey | ByteRTCRemoteStreamKey* | 远端视频流信息,房间、用户 ID、流属性等,参看 ByteRTCRemoteStreamKey |
| state | ByteRTCRemoteVideoState | 远端视频流的当前状态,参看 ByteRTCRemoteVideoState |
| reason | ByteRTCRemoteVideoStateChangeReason | 远端视频流状态改变的原因,参看 ByteRTCRemoteVideoStateChangeReason |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onAudioFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;
音频首帧发送状态改变时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| user | ByteRTCUser* | 本地用户信息,详见 ByteRTCUser |
| state | ByteRTCFirstFrameSendState | 首帧发送状态,详见 ByteRTCFirstFrameSendState |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onVideoFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;
视频首帧发送状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| user | ByteRTCUser* | 本地用户信息,详见 ByteRTCUser |
| state | ByteRTCFirstFrameSendState | 首帧发送状态,详见 ByteRTCFirstFrameSendState |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onScreenVideoFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;
屏幕共享流视频首帧发送状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| user | ByteRTCUser* | 本地用户信息,详见 ByteRTCUser |
| state | ByteRTCFirstFrameSendState | 首帧发送状态,详见 ByteRTCFirstFrameSendState |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onAudioFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;
音频首帧播放状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| user | ByteRTCUser* | 音频流来源的用户信息,参看 ByteRTCUser |
| state | ByteRTCFirstFramePlayState | 首帧播放状态,详见 ByteRTCFirstFramePlayState |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onVideoFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;
视频首帧播放状态改变时,收到此回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象。 |
| user | ByteRTCUser* | 视频流来源的用户信息,参看 ByteRTCUser |
| state | ByteRTCFirstFramePlayState | 首帧播放状态,详见 ByteRTCFirstFramePlayState |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onVideoStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned;
通过调用服务端 MuteUser/UnmuteUser 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 被禁用/解禁的视频流用户 ID |
| banned | BOOL | 视频流发送状态 • true: 视频流发送被禁用 • false: 视频流发送被解禁 |
注意
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onAudioStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned;
通过调用服务端 MuteUser/UnmuteUser 方法禁用/解禁指定房间内指定用户视音频流的发送时,触发此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 被禁用/解禁的音频流用户 ID |
| banned | BOOL | 音频流发送状态 • true: 音频流发送被禁用 • false: 音频流发送被解禁 |
注意
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onForwardStreamStateChanged:(NSArray<ForwardStreamStateInfo *> * _Nonnull)infos;
跨房间媒体流转发状态和错误回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象 |
| infos | NSArray |
跨房间媒体流转发目标房间信息数组,详见 ForwardStreamStateInfo |
- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onForwardStreamEvent:(NSArray<ForwardStreamEventInfo *> * _Nonnull)infos;
跨房间媒体流转发事件回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rtcRoom | ByteRTCRoom* | ByteRTCRoom 对象 |
| infos | NSArray |
跨房间媒体流转发目标房间事件数组,详见 ForwardStreamEventInfo |
- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onPushPublicStreamResult:(NSString *_Nonnull)streamid errorCode:(int)code;
公共流发布结果回调
startPushPublicStream:withLayout: 接口发布公共流后,启动结果通过此回调方法通知用户。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamid | NSString* | 公共流 ID |
| code | int | 公共流发布结果状态码200: 发布成功 |