ByteRTCVideoFrameObserver

@protocol ByteRTCVideoFrameObserver <NSObject>

成员函数

返回 名称
void onLocalScreenFrame:
void onLocalVideoFrame:
void onRemoteScreenFrame:user:room:
void onRemoteVideoFrame:user:room:

函数说明

onLocalScreenFrame:

- (void)onLocalScreenFrame:(ByteRTCVideoFrame * _Nonnull)frame;

本地屏幕流的视频帧数据回调

传入参数

参数名 类型 说明
frame ByteRTCVideoFrame* 本地屏幕视频帧数据,参考: ByteRTCVideoFrame

onLocalVideoFrame:

- (void)onLocalVideoFrame:(ByteRTCVideoFrame * _Nonnull)frame;

本地视频流的视频帧数据回调

传入参数

参数名 类型 说明
frame ByteRTCVideoFrame* 本地视频流的视频帧数据,参考: ByteRTCVideoFrame

onRemoteScreenFrame:user:room:

- (void)onRemoteScreenFrame:(ByteRTCVideoFrame * _Nonnull)frame user:(NSString * _Nullable)uid room:(NSString * _Nullable)room;

远端屏幕流的视频帧数据回调

传入参数

参数名 类型 说明
frame ByteRTCVideoFrame* 远端屏幕的视频帧数据,参考: ByteRTCVideoFrame
uid NSString* 远端屏幕共享用户ID
room NSString* 对应流的房间 id

onRemoteVideoFrame:user:room:

- (void)onRemoteVideoFrame:(ByteRTCVideoFrame * _Nonnull)frame user:(NSString * _Nullable)uid room:(NSString * _Nullable)room;

远端视频流的视频帧数据回调

传入参数

参数名 类型 说明
frame ByteRTCVideoFrame* 远端视频流的视频帧数据,参考: ByteRTCVideoFrame
uid NSString* 远端屏幕共享用户ID
room NSString* 对应流的房间 id

ByteRTCVideoProcessorDelegate

@protocol ByteRTCVideoProcessorDelegate <NSObject>

成员函数

返回 名称
ByteRTCVideoFrame* processVideoFrame:

函数说明

processVideoFrame:

- (ByteRTCVideoFrame* _Nullable) processVideoFrame:(ByteRTCVideoFrame* _Nonnull)src_frame;

获取 RTC SDK 采集得到的视频帧,根据 registerLocalVideoProcessor:withConfig: 设置的视频前处理器,进行视频前处理,最终将处理后的视频帧给到 RTC SDK 用于编码传输。

传入参数

参数名 类型 说明
src_frame ByteRTCVideoFrame* RTC SDK 采集得到的视频帧,参考: ByteRTCVideoFrame

返回值 经过视频前处理后的视频帧,返回给 RTC SDK 供编码和传输,参考: ByteRTCVideoFrame

注意 如果需要取消视频前处理,可以将视频前处理器设置为 nullptr。

ByteRTCLocalEncodedVideoFrameObserver

@protocol ByteRTCLocalEncodedVideoFrameObserver<NSObject>

本地视频帧监测器

成员函数

返回 名称
void onLocalEncodedVideoFrame:Frame:

函数说明

onLocalEncodedVideoFrame:Frame:

- (void)onLocalEncodedVideoFrame:(ByteRTCStreamIndex) streamIndex Frame:(ByteRTCEncodedVideoFrame * _Null_unspecified)frame;

调用 registerLocalEncodedVideoFrameObserver: 后,SDK 收到本地视频帧信息时,回调该事件

传入参数

参数名 类型 说明
streamIndex ByteRTCStreamIndex 本地视频帧类型,参看 ByteRTCStreamIndex
frame ByteRTCEncodedVideoFrame* _Null_unspecified 本地视频帧信息,参看 ByteRTCEncodedVideoFrame

ByteRTCExternalVideoEncoderEventHandler

@protocol ByteRTCExternalVideoEncoderEventHandler<NSObject>

自定义编码帧回调类

成员函数

返回 名称
void onStart:
void onStop:
void onRateUpdate:withVideoIndex:withFps:withBitRate:
void onRequestKeyFrame:withVideoIndex:

函数说明

onStart:

- (void)onStart:(ByteRTCStreamIndex)streamIndex;

提示自定义编码帧可以开始推送的回调。
收到该回调后,你即可调用 pushExternalEncodedVideoFrame:withVideoIndex:withEncodedVideoFrame: 向 SDK 推送自定义编码视频帧

传入参数

参数名 类型 说明
streamIndex ByteRTCStreamIndex 可以推送的编码流的属性,参看 ByteRTCStreamIndex

onStop:

- (void)onStop:(ByteRTCStreamIndex)streamIndex;

当收到该回调时,你需停止向 SDK 推送自定义编码视频帧

传入参数

参数名 类型 说明
streamIndex ByteRTCStreamIndex 需停止推送的编码流的属性,参看 ByteRTCStreamIndex

onRateUpdate:withVideoIndex:withFps:withBitRate:

- (void)onRateUpdate:(ByteRTCStreamIndex)streamIndex withVideoIndex:(NSInteger)videoIndex withFps:(NSInteger)fps withBitRate:(NSInteger)bitRateKps;

当自定义编码流的帧率或码率发生变化时,触发该回调

传入参数

参数名 类型 说明
streamIndex ByteRTCStreamIndex 发生变化的编码流的属性,参看 ByteRTCStreamIndex
videoIndex NSInteger 对应编码流的下标
fps NSInteger 变化后的帧率,单位:fps
bitRateKps NSInteger 变化后的码率,单位:kbps

onRequestKeyFrame:withVideoIndex:

- (void)onRequestKeyFrame:(ByteRTCStreamIndex)streamIndex withVideoIndex:(NSInteger)videoIndex;

调用 requestRemoteVideoKeyFrame: 请求远端关键帧时,会触发该回调

传入参数

参数名 类型 说明
streamIndex ByteRTCStreamIndex 远端编码流的属性,参看 ByteRTCStreamIndex
videoIndex NSInteger 对应编码流的下标

ByteRTCRemoteEncodedVideoFrameObserver

@protocol ByteRTCRemoteEncodedVideoFrameObserver<NSObject>

远端编码后视频数据监测器

成员函数

返回 名称
void onRemoteEncodedVideoFrame:withEncodedVideoFrame:

函数说明

onRemoteEncodedVideoFrame:withEncodedVideoFrame:

- (void)onRemoteEncodedVideoFrame:(ByteRTCRemoteStreamKey * _Nonnull)streamKey withEncodedVideoFrame:(ByteRTCEncodedVideoFrame* _Nonnull)videoFrame;

调用 registerRemoteEncodedVideoFrameObserver: 后,SDK 监测到远端编码后视频数据时,触发该回调

传入参数

参数名 类型 说明
streamKey ByteRTCRemoteStreamKey* 收到的远端流信息,参看 ByteRTCRemoteStreamKey
videoFrame ByteRTCEncodedVideoFrame* 收到的远端视频帧信息,参看 ByteRTCEncodedVideoFrame

LiveTranscodingDelegate

@protocol LiveTranscodingDelegate <NSObject>

转推直播观察者。

成员函数

返回 名称
BOOL isSupportClientPushStream
void onStreamMixingEvent:eventData:error:mixType:
void onMixingAudioFrame:
void onMixingVideoFrame:
void onMixingDataFrame:

函数说明

isSupportClientPushStream

- (BOOL)isSupportClientPushStream;

是否具有推流能力。

注意

onStreamMixingEvent:eventData:error:mixType:

- (void)onStreamMixingEvent:(ByteRTCStreamMixingEvent)event eventData:(NSString *_Nonnull)msg error:(ByteRtcTranscoderErrorCode)Code mixType:(ByteRTCStreamMixingType)mixType;

转推直播状态回调

传入参数

参数名 类型 说明
event ByteRTCStreamMixingEvent 合流状态,详见 ByteRTCStreamMixingEvent。
msg NSString* 事件参数,包含事件的状态信息
Code ByteRtcTranscoderErrorCode 转推直播错误码,详见枚举类 ByteRtcTranscoderErrorCode
mixType ByteRTCStreamMixingType 合流类型,详见 ByteRTCStreamMixingType

onMixingAudioFrame:

- (void)onMixingAudioFrame:(ByteRTCAudioFrame *_Nonnull)audioFrame;

端云一体合流音频 PCM 回调

传入参数

参数名 类型 说明
audioFrame ByteRTCAudioFrame* PCM 合流音频数据帧,详见 ByteRTCAudioFrame

注意

onMixingVideoFrame:

- (void)onMixingVideoFrame:(ByteRTCVideoFrame *_Nonnull)videoFrame;

端云一体合流视频 YUV 回调

传入参数

参数名 类型 说明
videoFrame ByteRTCVideoFrame* YUV 合流视频数据帧,详见 ByteRTCVideoFrame

注意

onMixingDataFrame:

- (void)onMixingDataFrame:(ByteRTCFrameExtendedData *_Nonnull)dataFrame;

端云一体合流视频 SEI 数据

传入参数

参数名 类型 说明
dataFrame ByteRTCFrameExtendedData* SEI 数据,详见 ByteRTCFrameExtendedData

ByteRTCEngineDelegate

@protocol ByteRTCEngineDelegate <NSObject>

成员函数

返回 名称
void rtcEngine:onWarning:
void rtcEngine:onError:
void rtcEngine:connectionChangedToState:
void rtcEngine:networkTypeChangedToType:
void rtcEngine:onJoinRoomResult:withUid:errorCode:joinType:elapsed:
void rtcEngine:onLeaveRoomWithStats:
void rtcEngine:onUserJoined:elapsed:
void rtcEngine:onUserLeave:reason:
void rtcEngine:onUserMuteAudio:muteState:
void rtcEngine:onUserStartAudioCapture:
void rtcEngine:onUserStopAudioCapture:
void rtcEngine:onFirstRemoteAudioFrame:
void rtcEngine:onAudioVolumeIndication:totalRemoteVolume:
void rtcEngine:onLocalAudioPropertiesReport:
void rtcEngine:onRemoteAudioPropertiesReport:totalRemoteVolume:
void rtcEngine:onUserMuteVideo:withMuteState:
void rtcEngine:onUserStartVideoCapture:
void rtcEngine:onUserStopVideoCapture:
void rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:
void rtcEngine:onFirstRemoteVideoFrameRendered:withFrameInfo:
void rtcEngine:onRemoteVideoSizeChanged:withFrameInfo:
void rtcEngine:onLocalVideoSizeChanged:withFrameInfo:
void rtcEngine:remoteVideoStateChangedOfUid:state:
void rtcEngine:onMediaDeviceStateChanged:device_type:device_state:device_error:
void rtcEngine:onAudioFrameSendStateChanged:state:
void rtcEngine:onVideoFrameSendStateChanged:state:
void rtcEngine:onScreenVideoFrameSendStateChanged:state:
void rtcEngine:onAudioFramePlayStateChanged:state:
void rtcEngine:onVideoFramePlayStateChanged:state:
void rtcEngine:onScreenVideoFramePlayStateChanged:state:
void rtcEngine:onFirstLocalAudioFrame:
void rtcEngine:onStreamAdd:
void rtcEngine:didStreamRemoved:stream:reason:
void rtcEngine:onVideoStreamBanned:isBanned:
void rtcEngine:onAudioStreamBanned:isBanned:
void rtcEngine:onAudioPlaybackDeviceChanged:
void rtcEngine:onRoomMessageReceived:message:
void rtcEngine:onRoomBinaryMessageReceived:message:
void rtcEngine:onSEIMessageReceived:andMessage:
void rtcEngine:onStreamSyncInfoReceived:streamType:data:
void rtcEngine:onRoomStats:
void rtcEngine:reportSysStats:
void rtcEngine:onLocalStreamStats:
void rtcEngine:onRemoteStreamStats:
void rtcEngine:onLocalAudioStateChanged:error:
void rtcEngine:onRemoteAudioStateChanged:state:reason:
void rtcEngine:onLocalVideoStateChanged:withStreamState:withStreamError:
void rtcEngine:onRemoteVideoStateChanged:withVideoState:withVideoStateReason:
void rtcEngine:onUserMessageReceived:message:
void rtcEngine:onUserBinaryMessageReceived:message:
void rtcEngine:onUserMessageSendResult:error:
void rtcEngine:onRoomMessageSendResult:error:
void rtcEngine:onLoginResult:errorCode:elapsed:
void rtcEngineOnLogout:
void rtcEngine:onServerParamsSetResult:
void rtcEngine:onGetPeerOnlineStatus:status:
void rtcEngine:onUserMessageReceivedOutsideRoom:message:
void rtcEngine:onUserBinaryMessageReceivedOutsideRoom:message:
void rtcEngine:onUserMessageSendResultOutsideRoom:error:
void rtcEngine:onServerMessageSendResult:error:
void rtcEngineLocalAudioMixingDidFinish:
void rtcEngineDidAudioEffectFinish:soundId:
void rtcEngine:onAudioMixingStateChanged:state:error:
void rtcEngine:onLiveTranscodingResult:errorCode:
void rtcEngine:onPerformanceAlarmsWithMode:roomId:reason:sourceWantedData:
void rtcEngine:OnSimulcastSubscribeFallback:
void rtcEngine:onHttpProxyState:
void rtcEngine:onHttpsProxyState:
void rtcEngine:onSocks5ProxyState:cmd:proxy_address:local_address:remote_address:
void rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:
void rtcEngine:onRecordingProgressUpdate:process:recording_info:

函数说明

rtcEngine:onWarning:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onWarning:(ByteRTCWarningCode)Code;

发生警告回调。
SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
Code ByteRTCWarningCode 警告代码,参看 ByteRTCWarningCode。

rtcEngine:onError:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onError:(ByteRTCErrorCode)errorCode;

发生错误回调。
SDK 运行时出现了网络或媒体相关的错误,且无法自动恢复时触发此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
errorCode ByteRTCErrorCode 错误代码,参看 ByteRTCErrorCode。

rtcEngine:connectionChangedToState:

- (void) rtcEngine:(ByteRTCEngineKit * _Nonnull)engine connectionChangedToState:(ByteRTCConnectionState) state;

SDK 与信令服务器连接状态改变回调。连接状态改变时触发。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
state ByteRTCConnectionState 当前 SDK 与信令服务器的连接状态,详见 ByteRTCConnectionState

rtcEngine:networkTypeChangedToType:

- (void) rtcEngine:(ByteRTCEngineKit * _Nonnull)engine networkTypeChangedToType:(ByteRTCNetworkType) type;

SDK 当前网络连接类型改变回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
type ByteRTCNetworkType SDK 当前的网络连接类型,详见 ByteRTCNetworkType

rtcEngine:onJoinRoomResult:withUid:errorCode:joinType:elapsed:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onJoinRoomResult:(NSString *_Nonnull)roomId withUid:(nonnull NSString *)uid errorCode:(NSInteger)errorCode joinType:(NSInteger)joinType elapsed:(NSInteger)elapsed;

首次加入房间/重连加入房间的回调,表示用户调用 joinRoomByKey:roomId:userInfo:rtcRoomConfig: 的结果,根据错误码判断成功/失败以及区别是否为重连。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
roomId NSString* 房间 ID。
uid NSString* 用户 ID。
errorCode NSInteger 用户加入房间回调的状态码。
• 0: 加入房间成功;
• 非 0: 加入房间失败,具体原因参看 ByteRTCErrorCode 以及 ByteRTCWarningCode。
joinType NSInteger 加入房间的类型。
• 0: 首次加入房间。用户手动调用 joinRoomByKey:roomId:userInfo:rtcRoomConfig:,收到加入成功。
• 1: 重新加入房间。用户网络较差,失去与服务器的连接,进行重连时收到加入成功。
elapsed NSInteger 重连耗时。本地用户从连接断开到重连成功所经历的时间间隔,单位为 ms 。

rtcEngine:onLeaveRoomWithStats:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLeaveRoomWithStats:(ByteRTCRoomStats *_Nonnull)stats;

离开房间成功回调。
用户调用 leaveRoom 方法后,SDK 会停止所有的发布订阅流,并释放所有通话相关的音视频资源。SDK 完成所有的资源释放后通过此回调通知用户。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCRoom 对象。
stats ByteRTCRoomStats* 本次通话的统计数据,详见数据结构 ByteRTCRoomStats 。

注意

rtcEngine:onUserJoined:elapsed:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onUserJoined:(nonnull ByteRTCUserInfo *)userInfo elapsed:(NSInteger)elapsed;

远端可见用户加入房间,或房内隐身用户切换为可见的回调。
1. 远端用户调用 setUserVisibility: 方法将自身设为可见后加入房间时,房间内其他用户将收到该事件。
2. 远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
3. 房间内隐身远端用户调用 setUserVisibility: 方法切换至可见时,房间内其他用户将收到该事件。
4. 新进房用户会收到进房前已在房内的主播角色用户的进房回调通知。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
userInfo ByteRTCUserInfo* 用户信息,参看 ByteRTCUserInfo。
elapsed NSInteger 保留字段,无意义

rtcEngine:onUserLeave:reason:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason;

远端可见用户离开房间,或从可见切换为隐身的回调。
发生以下情形时,房间内其他用户会收到此事件:
1.远端可见用户调用 leaveRoom: 方法离开房间时;
2.远端可见用户调用 setUserVisibility: 方法切换至隐身;
3.远端可见用户断网,且一直未恢复。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
uid NSString* 离开房间,或切至隐身的远端用户 ID 。
reason ByteRTCUserOfflineReason 用户离开房间的原因,参看 ByteRTCUserOfflineReason。

rtcEngine:onUserMuteAudio:muteState:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMuteAudio:(NSString * _Nonnull)uid muteState:(ByteRTCMuteState)muteState;

房间内某用户调用 muteLocalAudio: 改变本地音频发送状态时,房间内其他用户会收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
uid NSString* 改变本地音频发送状态的用户 ID
muteState ByteRTCMuteState 发送状态,详见 ByteRTCMuteState

rtcEngine:onUserStartAudioCapture:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserStartAudioCapture:(NSString *_Nonnull)userId;

房间内的用户调用 startAudioCapture 开启音频采集时,房间内其他用户会收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
userId NSString* 开启音频采集的远端用户 ID

rtcEngine:onUserStopAudioCapture:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserStopAudioCapture:(NSString *_Nonnull)userId;

房间内的用户调用 stopAudioCapture 关闭音频采集时,房间内其他用户会收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
userId NSString* 关闭音频采集的远端用户 ID

rtcEngine:onFirstRemoteAudioFrame:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstRemoteAudioFrame:(ByteRTCRemoteStreamKey * _Nonnull)key;

当收到远端流的第一帧音频的时候上报该事件

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
key ByteRTCRemoteStreamKey* 远端流信息, 详见 ByteRTCRemoteStreamKey

注意 用户刚收到房间内每一路音频流时,都会收到该回调。

rtcEngine:onAudioVolumeIndication:totalRemoteVolume:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioVolumeIndication:(NSArray<ByteRTCAudioVolumeInfo *> * _Nonnull)speakers totalRemoteVolume:(NSInteger)totalRemoteVolume;

提示本地采集的音量信息和在房间内订阅的远端用户的音量信息。
本回调默认不开启。你可以通过调用 setAudioVolumeIndicationInterval: 开启。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
speakers NSArray* 本地用户和订阅的远端用户的 ID 和音量。
参看 ByteRTCAudioVolumeInfo。
totalRemoteVolume NSInteger speakers 中包含的所有音频音量之和,取值范围是 [0,255]。

注意

rtcEngine:onLocalAudioPropertiesReport:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onLocalAudioPropertiesReport:(NSArray<ByteRTCLocalAudioPropertiesInfo *> * _Nonnull)audioPropertiesInfos;

调用 enableAudioPropertiesReport: 后,可能会周期性收到此回调,获取本地音量信息。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit*
audioPropertiesInfos NSArray* 本地音频信息,详见 ByteRTCLocalAudioPropertiesInfo 。

注意 1. 使用 RTC SDK 内部机制采集麦克风音频时,回调麦克风的音量;
2. 使用 RTC SDK 内部机制采集屏幕音频时,回调屏幕音频的音量。

rtcEngine:onRemoteAudioPropertiesReport:totalRemoteVolume:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRemoteAudioPropertiesReport:(NSArray<ByteRTCRemoteAudioPropertiesInfo *> * _Nonnull)audioPropertiesInfos totalRemoteVolume:(NSInteger)totalRemoteVolume;

调用 enableAudioPropertiesReport: 后,可能会周期性收到此回调,获取订阅的远端用户的音量信息。

传入参数

参数名 类型 说明
audioPropertiesInfos NSArray* 远端音频信息,其中包含音频流属性、房间 ID、用户 ID ,详见 ByteRTCRemoteAudioPropertiesInfo。
totalRemoteVolume NSInteger 所有订阅的远端流的总音量,范围是 [0,255]。
• [0,25] 接近无声;
• [25,75] 为低音量;
• [76,204] 为中音量;
• [205,255] 为高音量。

注意 要获取接收的来自远端的音频音量信息时,不限定音频采集方式,RTC SDK 内部采集机制和自定义采集都可以。

rtcEngine:onUserMuteVideo:withMuteState:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMuteVideo:(NSString * _Nonnull)uid withMuteState:(ByteRTCMuteState)muteState;

房间内用户调用 muteLocalVideo: 暂停/恢复发送视频流时,房间内其他用户会收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
uid NSString* 暂停/恢复发送视频流的用户 ID。
muteState ByteRTCMuteState 暂停/恢复发送视频流。参看 ByteRTCMuteState

rtcEngine:onUserStartVideoCapture:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserStartVideoCapture:(NSString *_Nonnull)userId;

房间中用户调用 startVideoCapture 时,房间中其他用户会收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
userId NSString* 调用 startVideoCapture 接口的远端用户 ID

rtcEngine:onUserStopVideoCapture:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserStopVideoCapture:(NSString *_Nonnull)userId;

房间中远端用户调用 stopVideoCapture 时,本地用户将会收到该回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
userId NSString* 调用 stopVideoCapture 接口的远端用户 ID

rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstLocalVideoFrameCaptured:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo;

第一帧本地采集的视频/屏幕共享画面在本地视图渲染完成时,收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
streamIndex ByteRTCStreamIndex 流属性,参看 ByteRTCStreamIndex
frameInfo ByteRTCVideoFrameInfo* 视频帧信息,参看 ByteRTCVideoFrameInfo

rtcEngine:onFirstRemoteVideoFrameRendered:withFrameInfo:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstRemoteVideoFrameRendered:(ByteRTCRemoteStreamKey * _Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo;

第一帧远端视频流在视图上渲染成功后,收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
streamKey ByteRTCRemoteStreamKey* 远端流信息,参看 ByteRTCRemoteStreamKey
frameInfo ByteRTCVideoFrameInfo* 视频帧信息,参看 ByteRTCVideoFrameInfo

rtcEngine:onRemoteVideoSizeChanged:withFrameInfo:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRemoteVideoSizeChanged:(ByteRTCRemoteStreamKey *_Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;

远端视频大小或旋转信息发生变化时,房间内订阅此视频流的用户会收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
streamKey ByteRTCRemoteStreamKey* 流属性,参看 ByteRTCRemoteStreamKey
frameInfo ByteRTCVideoFrameInfo* 视频帧信息,参看 ByteRTCVideoFrameInfo

rtcEngine:onLocalVideoSizeChanged:withFrameInfo:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLocalVideoSizeChanged:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;

本地视频大小或旋转信息发生变化时,收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
streamIndex ByteRTCStreamIndex 流属性,参看 ByteRTCStreamIndex
frameInfo ByteRTCVideoFrameInfo* 视频帧信息,参看 ByteRTCVideoFrameInfo:ByteRTCStreamIndex

rtcEngine:remoteVideoStateChangedOfUid:state:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine remoteVideoStateChangedOfUid:(NSString * _Nonnull)uid state:(ByteRTCRemoteVideoState)state;

远端视频流状态发生改变回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象,参考: ByteRTCEngineKit
uid NSString* 发生视频流状态改变的远端用户的用户ID
state ByteRTCRemoteVideoState 变更后的远端视频流状态,详见类型 ByteRTCRemoteVideoState

rtcEngine:onMediaDeviceStateChanged:device_type:device_state:device_error:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onMediaDeviceStateChanged:(NSString*_Nonnull)device_id device_type:(ByteRTCMediaDeviceType)device_type device_state:(ByteRTCMediaDeviceState)device_state device_error:(ByteRTCMediaDeviceError)device_error;

媒体设备状态回调。媒体设备包括音频采集设备、音频渲染设备、视频采集设备三种类型。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
device_id NSString* 设备 ID
device_type ByteRTCMediaDeviceType 设备类型,参看 ByteRTCMediaDeviceType
device_state ByteRTCMediaDeviceState 设备状态,参看 ByteRTCMediaDeviceState
device_error ByteRTCMediaDeviceError 设备错误类型,参看 ByteRTCMediaDeviceError

rtcEngine:onAudioFrameSendStateChanged:state:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onAudioFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;

音频首帧发送状态改变时,收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
user ByteRTCUser* 本地用户信息,详见 ByteRTCUser
state ByteRTCFirstFrameSendState 首帧发送状态,详见 ByteRTCFirstFrameSendState

rtcEngine:onVideoFrameSendStateChanged:state:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onVideoFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;

视频首帧发送状态改变时,收到此回调

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
user ByteRTCUser* 本地用户信息,详见 ByteRTCUser
state ByteRTCFirstFrameSendState 首帧发送状态,详见 ByteRTCFirstFrameSendState

rtcEngine:onScreenVideoFrameSendStateChanged:state:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onScreenVideoFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;

屏幕共享流视频首帧发送状态改变时,收到此回调

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
user ByteRTCUser* 本地用户信息,参看 ByteRTCUser
state ByteRTCFirstFrameSendState 首帧发送状态,参看 ByteRTCFirstFrameSendState

rtcEngine:onAudioFramePlayStateChanged:state:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onAudioFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;

音频首帧播放状态改变时,收到此回调

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
user ByteRTCUser* 音频流来源的用户信息,参看 ByteRTCUser
state ByteRTCFirstFramePlayState 首帧播放状态,参看 ByteRTCFirstFramePlayState

rtcEngine:onVideoFramePlayStateChanged:state:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onVideoFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;

视频首帧播放状态改变时,收到此回调

传入参数

参数名 类型 说明
user ByteRTCUser* 视频流来源的用户信息,参看 ByteRTCUser
state ByteRTCFirstFramePlayState 首帧播放状态,参看 ByteRTCFirstFramePlayState

rtcEngine:onScreenVideoFramePlayStateChanged:state:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onScreenVideoFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;

屏幕共享流视频首帧播放状态改变时,收到此回调

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
user ByteRTCUser* 屏幕共享流来源的用户信息,参看 ByteRTCUser
state ByteRTCFirstFramePlayState 首帧播放状态,参看 ByteRTCFirstFramePlayState

rtcEngine:onFirstLocalAudioFrame:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstLocalAudioFrame:(ByteRTCStreamIndex) streamIndex;

本地采集到第一帧音频帧时,收到该回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
streamIndex ByteRTCStreamIndex 音频流属性, 详见 ByteRTCStreamIndex

rtcEngine:onStreamAdd:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onStreamAdd:(id <ByteRTCStream> _Nonnull)stream;

以下情况会触发此回调:

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
stream id 流的属性,参看 ByteRTCStream 数据类型。

rtcEngine:didStreamRemoved:stream:reason:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine didStreamRemoved:(NSString *_Nonnull)uid stream:(id<ByteRTCStream> _Nonnull)stream reason:(ByteRTCStreamRemoveReason)reason;

房间内的远端用户停止发布音视频流时,本地用户会收到此回调通知。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
uid NSString* 远端流来源的用户 ID 。
stream id 流的属性,参看 ByteRTCStream。
reason ByteRTCStreamRemoveReason 远端流移除的原因,参看 ByteRTCStreamRemoveReason 。

rtcEngine:onVideoStreamBanned:isBanned:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onVideoStreamBanned:(NSString* _Nonnull)uid isBanned:(BOOL)banned;

通过调用服务端 MuteUser/UnmuteUser 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。

传入参数

参数名 类型 说明
uid NSString* 被禁用/解禁的视频流用户 ID
banned BOOL 视频流发送状态
• true: 视频流发送被禁用
• false: 视频流发送被解禁

注意

rtcEngine:onAudioStreamBanned:isBanned:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioStreamBanned:(NSString* _Nonnull)uid isBanned:(BOOL)banned;

通过调用服务端 MuteUser/UnmuteUser 方法禁用/解禁指定房间内指定用户视音频流的发送时,触发此回调。

传入参数

参数名 类型 说明
uid NSString* 被禁用/解禁的音频流用户 ID
banned BOOL 音频流发送状态
• true: 音频流发送被禁用
• false: 音频流发送被解禁

注意

rtcEngine:onAudioPlaybackDeviceChanged:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioPlaybackDeviceChanged:(ByteRTCAudioPlaybackDevice)device;

音频播放设备变化时,收到该回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
device ByteRTCAudioPlaybackDevice 新的音频设备,详见 ByteRTCAudioPlaybackDevice

注意 音频设备设置与音频路由策略,详见 setAudioPlaybackDevice:

rtcEngine:onRoomMessageReceived:message:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRoomMessageReceived:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message;

收到房间中调用 sendRoomMessage: 发送的广播文本消息时,收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* 当前 RTCEngine 实例。
uid NSString* 消息发送者 ID 。
message NSString* 收到的文本消息内容。

rtcEngine:onRoomBinaryMessageReceived:message:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRoomBinaryMessageReceived:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message;

收到房间中调用 sendRoomBinaryMessage: 发送的广播二进制消息时,收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* 当前 RTCEngine 实例。
uid NSString* 消息发送者 ID 。
message NSData* 收到的二进制消息内容。

rtcEngine:onSEIMessageReceived:andMessage:

- (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 消息内容

rtcEngine:onStreamSyncInfoReceived:streamType:data:

- (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* 消息内容。

rtcEngine:onRoomStats:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRoomStats:(ByteRTCRoomStats *_Nonnull)stats;

房间内通话统计信息回调。
用户进房开始通话后,每 2s 收到一次本回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
stats ByteRTCRoomStats* 当前 RtcEngine 统计数据,详见 ByteRTCRoomStats

rtcEngine:reportSysStats:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine reportSysStats:(const ByteRTCSysStats * _Nonnull)stats;

报告当前设备 cpu 与 memory 使用率,每 2s 触发一次。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
stats const ByteRTCSysStats* cpu 和 memory 使用率信息,详见 ByteRTCSysStats 数据类型

rtcEngine:onLocalStreamStats:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLocalStreamStats:(const ByteRTCLocalStreamStats *_Nonnull)stats;

本地流数据统计以及网络质量回调。
本地用户发布流成功后,SDK 会周期性(2s)的通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
统计信息通过 ByteRTCLocalStreamStats 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象。
stats const ByteRTCLocalStreamStats* 发布音/视频流质量以及本地网络质量统计数据,参看 ByteRTCLocalStreamStats 数据类型。

rtcEngine:onRemoteStreamStats:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRemoteStreamStats:(const ByteRTCRemoteStreamStats *_Nonnull)stats;

本地订阅的远端音/视频流数据统计以及网络质量回调。
本地用户订阅流成功后,SDK 会周期性(2s)的通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
stats const ByteRTCRemoteStreamStats* 当前 RtcEngine 统计数据,详见 ByteRTCRemoteStreamStats

rtcEngine:onLocalAudioStateChanged:error:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLocalAudioStateChanged:(ByteRTCLocalAudioStreamState)state error:(ByteRTCLocalAudioStreamError)error;

本地音频流的状态发生改变时,收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
state ByteRTCLocalAudioStreamState 本地音频设备的当前状态,详见 ByteRTCLocalAudioStreamState
error ByteRTCLocalAudioStreamError 本地音频流状态改变时的错误码,详见 ByteRTCLocalAudioStreamError

rtcEngine:onRemoteAudioStateChanged:state:reason:

- (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

rtcEngine:onLocalVideoStateChanged:withStreamState:withStreamError:

- (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

rtcEngine:onRemoteVideoStateChanged:withVideoState:withVideoStateReason:

- (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

rtcEngine:onUserMessageReceived:message:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageReceived:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message;

收到来自房间中其他用户通过 sendUserMessage:message: 发来的文本消息时(P2P),会收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* 当前 RTCEngine 实例。
uid NSString* 消息发送者的用户 ID 。
message NSString* 收到的文本消息内容。

rtcEngine:onUserBinaryMessageReceived:message:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserBinaryMessageReceived:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message;

收到来自房间中其他用户通过 sendUserBinaryMessage:message: 发来的二进制消息时,会收到此回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* 当前 RTCEngine 实例。
uid NSString* 消息发送者的用户 ID 。
message NSData* 收到的二进制消息内容。

rtcEngine:onUserMessageSendResult:error:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageSendResult:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error;

向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
msgid int64_t 本条消息的 ID。
error ByteRTCUserMessageSendResult 消息发送结果,详见 ByteRTCUserMessageSendResult

注意

rtcEngine:onRoomMessageSendResult:error:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRoomMessageSendResult:(int64_t)msgid error:(ByteRTCRoomMessageSendResult)error;

向房间内所有用户群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
msgid int64_t 本条消息的 ID。
error ByteRTCRoomMessageSendResult 消息发送结果,详见 ByteRTCRoomMessageSendResult

注意

rtcEngine:onLoginResult:errorCode:elapsed:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onLoginResult:(NSString * _Nonnull)uid errorCode:(ByteRTCLoginErrorCode)errorCode elapsed:(NSInteger)elapsed;

登录结果回调

传入参数

参数名 类型 说明
uid NSString* 登录用户 ID
errorCode ByteRTCLoginErrorCode 登录结果
详见 ByteRTCLoginErrorCode。
elapsed NSInteger 从调用 login:uid: 接口开始到返回结果所用时长。
单位为 ms。

注意 调用 login:uid: 后,会收到此回调。

rtcEngineOnLogout:

- (void)rtcEngineOnLogout:(ByteRTCEngineKit * _Nonnull)engine;

登出结果回调

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象

注意 调用 logout 后,会收到此回调。

rtcEngine:onServerParamsSetResult:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onServerParamsSetResult:(NSInteger)errorCode;

设置业务服务器参数的返回结果

传入参数

参数名 类型 说明
errorCode NSInteger 设置结果
• 返回 200,设置成功
• 返回其他,设置失败

注意 调用 setServerParams:url: 后,会收到此回调。

rtcEngine:onGetPeerOnlineStatus:status:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onGetPeerOnlineStatus:(NSString * _Nonnull)peerUserId status:(ByteRTCUserOnlineStatus)status;

查询对端或本端用户登录状态的返回结果

传入参数

参数名 类型 说明
peerUserId NSString* 需要查询的用户 ID
status ByteRTCUserOnlineStatus 查询的用户登录状态
详见 ByteRTCUserOnlineStatus.

注意 必须先调用 getPeerOnlineStatus:,才能收到此回调。

rtcEngine:onUserMessageReceivedOutsideRoom:message:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageReceivedOutsideRoom:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message;

收到房间外用户调用 sendUserMessageOutsideRoom:message: 发来的文本消息时,会收到此回调

传入参数

参数名 类型 说明
uid NSString* 消息发送者 ID
message NSString* 收到的文本消息内容

rtcEngine:onUserBinaryMessageReceivedOutsideRoom:message:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserBinaryMessageReceivedOutsideRoom:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message;

收到房间外用户调用 sendUserBinaryMessageOutsideRoom:message: 发来的二进制消息时,会收到此回调。

传入参数

参数名 类型 说明
uid NSString* 消息发送者 ID
message NSData* 收到的二进制消息内容

rtcEngine:onUserMessageSendResultOutsideRoom:error:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageSendResultOutsideRoom:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error;

给房间外指定的用户发送消息的回调

传入参数

参数名 类型 说明
msgid int64_t 本条消息的 ID
所有的 P2P 和 P2Server 消息共用一个 ID 序列。
error ByteRTCUserMessageSendResult 消息发送结果
详见 ByteRTCUserMessageSendResult。

注意 当调用 sendUserMessageOutsideRoom:message: 或 sendUserBinaryMessageOutsideRoom:message: 发送消息后,会收到此回调。

rtcEngine:onServerMessageSendResult:error:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onServerMessageSendResult:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error;

给业务服务器发送消息的回调

传入参数

参数名 类型 说明
msgid int64_t 本条消息的 ID
所有的 P2P 和 P2Server 消息共用一个 ID 序列。
error ByteRTCUserMessageSendResult 消息发送结果
详见 ByteRTCUserMessageSendResult。

注意 当调用 sendServerMessage: 或 sendServerBinaryMessage: 接口发送消息后,会收到此回调。

rtcEngineLocalAudioMixingDidFinish:

- (void)rtcEngineLocalAudioMixingDidFinish:(ByteRTCEngineKit *_Nonnull)engine;

音乐文件混音结束回调。SDK通过此回调通知应用层音乐文件混音结束。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* 当前RTC SDK对象

rtcEngineDidAudioEffectFinish:soundId:

- (void)rtcEngineDidAudioEffectFinish:(ByteRTCEngineKit *_Nonnull)engine soundId:(NSInteger)soundId;

音效文件混音结束回调。SDK通过此回调通知应用层音效文件混音结束

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* 当前RTC SDK对象
soundId NSInteger 音效ID

rtcEngine:onAudioMixingStateChanged:state:error:

- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioMixingStateChanged:(NSInteger)id state:(ByteRTCAudioMixingState)state error:(ByteRTCAudioMixingError)error;

音频混音文件播放状态改变时回调

传入参数

参数名 类型 说明
id NSInteger 混音 ID
使用 ByteRTCAudioMixingManager 相关接口时传入的唯一 ID。
state ByteRTCAudioMixingState 混音状态
其混音状态可参考:ByteRTCAudioMixingState。
error ByteRTCAudioMixingError 错误码
详见 ByteRTCAudioMixingError。

注意

rtcEngine:onLiveTranscodingResult:errorCode:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLiveTranscodingResult:(NSString *_Nonnull)url errorCode:(ByteRTCTranscodingError)errorCode;

转推直播错误回调。
调用 startLiveTranscoding:observer: 接口或直接在服务端启动转推直播功能后,你会通过此回调收到启动结果和推流过程中的错误。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* engine 实例
url NSString* 推流地址的 URL。
errorCode ByteRTCTranscodingError 转推直播功能错误码,详见枚举类型 ByteRTCTranscodingError。

rtcEngine:onPerformanceAlarmsWithMode:roomId:reason:sourceWantedData:

- (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。

rtcEngine:OnSimulcastSubscribeFallback:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine OnSimulcastSubscribeFallback:(ByteRTCRemoteStreamSwitchEvent *_Nonnull)event;

因发布/订阅性能回退或退出回退状态,订阅的音视频流,发生流的切换时,收到该回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* 当前 RTCEngine 实例
event ByteRTCRemoteStreamSwitchEvent* 流切换信息。详见 ByteRTCRemoteStreamSwitchEvent。

注意

rtcEngine:onHttpProxyState:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onHttpProxyState:(NSInteger)state;

HTTP 代理连接状态改变时,收到该回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
state NSInteger 当前 HTTP 代理连接状态

rtcEngine:onHttpsProxyState:

- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onHttpsProxyState:(NSInteger)state;

HTTPS 代理连接状态改变时,收到该回调。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
state NSInteger 当前 HTTPS 代理连接状态

rtcEngine:onSocks5ProxyState:cmd:proxy_address:local_address:remote_address:

- (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* 远端的连接地址

rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:

- (void)rtcEngine:(ByteRTCEngineKit* _Nonnull)engine onRecordingStateUpdate:(ByteRTCStreamIndex)type state:(ByteRTCRecordingState)state error_code:(ByteRTCRecordingErrorCode)error_code recording_info:(ByteRTCRecordingInfo* _Nonnull)recording_info;

获取本地录制状态回调。
该回调由 startFileRecording:withRecordingConfig: 或 stopFileRecording: 触发。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
type ByteRTCStreamIndex 录制流的流属性,参看 ByteRTCStreamIndex
state ByteRTCRecordingState 录制状态,参看 ByteRTCRecordingState
error_code ByteRTCRecordingErrorCode 录制错误码,参看 ByteRTCRecordingErrorCode
recording_info ByteRTCRecordingInfo* 录制文件的详细信息,参看 ByteRTCRecordingInfo

rtcEngine:onRecordingProgressUpdate:process:recording_info:

- (void)rtcEngine:(ByteRTCEngineKit* _Nonnull)engine onRecordingProgressUpdate:(ByteRTCStreamIndex)type process:(ByteRTCRecordingProgress* _Nonnull)process recording_info:(ByteRTCRecordingInfo* _Nonnull)recording_info;

本地录制进度回调。
该回调由 startFileRecording:withRecordingConfig: 触发,录制状态正常时,系统每秒钟都会通过该回调提示录制进度。

传入参数

参数名 类型 说明
engine ByteRTCEngineKit* ByteRTCEngineKit 对象
type ByteRTCStreamIndex 录制流的流属性,参看 ByteRTCStreamIndex
process ByteRTCRecordingProgress* 录制进度,参看 ByteRTCRecordingProgress
recording_info ByteRTCRecordingInfo* 录制文件的详细信息,参看 ByteRTCRecordingInfo

ByteRTCAudioFrameObserver

@protocol ByteRTCAudioFrameObserver <NSObject>

音频数据代理

成员函数

返回 名称
void onRecordAudioFrame:
void onPlaybackAudioFrame:
void onMixedAudioFrame:

函数说明

onRecordAudioFrame:

- (void)onRecordAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;

返回麦克风录制的音频数据

传入参数

参数名 类型 说明
audioFrame ByteRTCAudioFrame* 麦克风录制的音频数据, 详见: ByteRTCAudioFrame

onPlaybackAudioFrame:

- (void)onPlaybackAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;

返回远端所有用户混音后的音频数据

传入参数

参数名 类型 说明
audioFrame ByteRTCAudioFrame* 远端所有用户混音后的音频数据, 详见: ByteRTCAudioFrame

onMixedAudioFrame:

- (void)onMixedAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;

返回本地麦克风录制和远端所有用户混音后的音频数据

传入参数

参数名 类型 说明
audioFrame ByteRTCAudioFrame* 本地麦克风录制和远端所有用户混音后的音频数据, 详见: ByteRTCAudioFrame

ByteRTCEncryptHandler

@protocol ByteRTCEncryptHandler <NSObject>

自定义加密接口

成员函数

返回 名称
NSData* ByteRTCEncryptRawData:
NSData* ByteRTCDecryptRawData:

函数说明

ByteRTCEncryptRawData:

- (NSData * _Nonnull) ByteRTCEncryptRawData:(NSData * _Nonnull)rawData;

自定义加密。
使用设定的自定义加密方式,对传输前的音视频帧数据进行加密。

传入参数

参数名 类型 说明
rawData NSData* 原始音视频帧数据

返回值 加密后的数据

注意

ByteRTCDecryptRawData:

- (NSData * _Nonnull) ByteRTCDecryptRawData:(NSData * _Nonnull)rawData;

自定义解密。
对自定义加密后的音视频帧数据进行解密。关于自定义加密,参看 ByteRTCEncryptRawData:。

传入参数

参数名 类型 说明
rawData NSData* 收到的已加密的音视频帧数据

返回值 解密后的数据

注意

ByteRTCMonitorDelegate

@protocol ByteRTCMonitorDelegate <NSObject>

非业务相关的监控事件回调

成员函数

返回 名称
void onMonitorLog:withType:
BOOL isConsole
void onVerboseLogWithLevel:filename:tag:line:functionName:format:

函数说明

onMonitorLog:withType:

- (void)onMonitorLog:(NSDictionary * _Nullable)data withType:(NSString * _Nullable)type;

埋点日志回调

传入参数

参数名 类型 说明
data NSDictionary* 具体的埋点内容
type NSString* 埋点的类型

isConsole

- (BOOL)isConsole;

是否进行控制台输出

返回值 返回是否进行控制台输出

onVerboseLogWithLevel:filename:tag:line:functionName:format:

- (void)onVerboseLogWithLevel:(ByteRTCLogLevel)level filename:(NSString * _Nonnull)filename tag:(NSString * _Nonnull)tag line:(int)line functionName:(NSString * _Nonnull)funcName format:(NSString * _Nonnull)format;

输出更多的调试信息

ByteRTCRoomDelegate

@protocol ByteRTCRoomDelegate <NSObject>

房间事件回调接口

成员函数

返回 名称
void rtcRoom:onJoinRoomResult:withUid:errorCode:joinType:elapsed:
void rtcRoom:onRoomWarning:
void rtcRoom:onRoomError:
void rtcRoom:onAudioVolumeIndication:totalRemoteVolume:
void rtcRoom:onRoomStats:
void rtcRoom:onLocalStreamStats:
void rtcRoom:onRemoteStreamStats:
void rtcRoom:onUserJoined:elapsed:
void rtcRoom:onUserLeave:reason:
void rtcRoom:onUserMuteAudio:muteState:
void rtcRoom:onUserStartAudioCapture:
void rtcRoom:onUserStopAudioCapture:
void rtcRoom:onFirstLocalAudioFrame:
void rtcRoom:onFirstRemoteAudioFrame:
void rtcRoom:onStreamAdd:
void rtcRoom:didStreamRemoved:stream:reason:
void rtcRoom:onRoomMessageReceived:message:
void rtcRoom:onRoomBinaryMessageReceived:message:
void rtcRoom:onUserMessageReceived:message:
void rtcRoom:onUserBinaryMessageReceived:message:
void rtcRoom:onUserMessageSendResult:error:
void rtcRoom:onRoomMessageSendResult:error:
void rtcRoom:onLiveTranscodingResult:errorCode:
void rtcRoom:onFirstLocalVideoFrameCaptured:withFrameInfo:
void rtcRoom:onLocalVideoSizeChanged:withFrameInfo:
void rtcRoom:onRemoteVideoSizeChanged:withFrameInfo:
void rtcRoom:onFirstRemoteVideoFrameRendered:withFrameInfo:
void rtcRoom:onUserMuteVideo:withMuteState:
void rtcRoom:onUserStartVideoCapture:
void rtcRoom:onUserStopVideoCapture:
void rtcRoom:onLocalAudioStateChanged:error:
void rtcRoom:onRemoteAudioStateChanged:state:reason:
void rtcRoom:onLocalVideoStateChanged:withStreamState:withStreamError:
void rtcRoom:onRemoteVideoStateChanged:withVideoState:withVideoStateReason:
void rtcRoom:onAudioFrameSendStateChanged:state:
void rtcRoom:onVideoFrameSendStateChanged:state:
void rtcRoom:onScreenVideoFrameSendStateChanged:state:
void rtcRoom:onAudioFramePlayStateChanged:state:
void rtcRoom:onVideoFramePlayStateChanged:state:
void rtcRoom:onVideoStreamBanned:isBanned:
void rtcRoom:onAudioStreamBanned:isBanned:

函数说明

rtcRoom:onJoinRoomResult:withUid:errorCode:joinType:elapsed:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onJoinRoomResult:(NSString *_Nonnull)roomId withUid:(nonnull NSString *)uid errorCode:(NSInteger)errorCode joinType:(NSInteger)joinType elapsed:(NSInteger)elapsed;

首次加入房间/重连加入房间的回调。根据错误码判断成功/失败以及区别是否为重连。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
roomId NSString* 房间 ID。
uid NSString* 用户 ID。
errorCode NSInteger 用户加入房间回调的状态码。参看 ByteRTCErrorCode 以及 ByteRTCWarningCode。
• 0: 成功
• <0: 失败
joinType NSInteger 加入房间的类型。
• 0: 首次加入房间。用户通过调用 joinRoomByToken:userInfo:roomConfig:,加入成功。
• 1: 重新加入房间。用户网络较差,失去与服务器的连接,重连加入成功。
elapsed NSInteger 重连耗时。本地用户从连接断开到重连成功所经历的时间间隔,单位为 ms 。

rtcRoom:onRoomWarning:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomWarning:(ByteRTCWarningCode)warningCode;

发生警告回调。
SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
warningCode ByteRTCWarningCode 警告码,详见枚举类型 ByteRTCWarningCode 。

rtcRoom:onRoomError:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomError:(ByteRTCErrorCode)errorCode;

发生错误回调。
SDK 运行时出现了错误。SDK 通常无法自动恢复,应用需要采取行动。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
errorCode ByteRTCErrorCode 错误码,详见枚举类型 ByteRTCErrorCode 。

rtcRoom:onAudioVolumeIndication:totalRemoteVolume:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onAudioVolumeIndication:(NSArray<ByteRTCAudioVolumeInfo *> *_Nonnull)speakers totalRemoteVolume:(NSInteger)totalRemoteVolume;

提示本地采集的音量信息和在房间内订阅的远端用户的音量信息。
本回调默认不开启。你可以通过调用 setAudioVolumeIndicationInterval: 开启。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
speakers NSArray* 本地用户和订阅的远端用户的 ID 和音量。
参看 ByteRTCAudioVolumeInfo。
totalRemoteVolume NSInteger speakers 中包含的所有音频音量之和,取值范围是 [0,255]。

注意

rtcRoom:onRoomStats:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomStats:(ByteRTCRoomStats *_Nonnull)stats;

房间内通话统计信息回调。
用户进房开始通话后,每 2s 收到一次本回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
stats ByteRTCRoomStats* 当前 ByteRTCRoom 统计数据,详见:ByteRTCRoomStats

rtcRoom:onLocalStreamStats:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onLocalStreamStats:(ByteRTCLocalStreamStats *_Nonnull)stats;

本地流数据统计以及网络质量回调。
本地用户发布流成功后,SDK 会周期性(2s)的通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
统计信息通过 ByteRTCLocalStreamStats 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
stats ByteRTCLocalStreamStats* 当前房间本地流数据统计。详见:ByteRTCLocalStreamStats

rtcRoom:onRemoteStreamStats:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRemoteStreamStats:(ByteRTCRemoteStreamStats *_Nonnull)stats;

本地订阅的远端音/视频流数据统计以及网络质量回调。
本地用户订阅流成功后,SDK 会周期性(2s)的通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
stats ByteRTCRemoteStreamStats* 当前房间本地流数据统计。 详见:ByteRTCRemoteStreamStats

rtcRoom:onUserJoined:elapsed:

- (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 保留字段,无意义

rtcRoom:onUserLeave:reason:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason;

远端可见用户离开房间,或从可见切换为隐身的回调。
发生以下情形时,房间内其他用户会收到此事件:
1.远端可见用户调用 leaveRoom 方法离开房间时;
2.远端可见用户调用 setUserVisibility: 方法切换至隐身;
3.远端可见用户断网,且一直未恢复。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
uid NSString* 离开房间,或切至隐身的远端用户 ID 。
reason ByteRTCUserOfflineReason 用户离开房间的原因,参看 ByteRTCUserOfflineReason。

rtcRoom:onUserMuteAudio:muteState:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserMuteAudio:(NSString *_Nonnull)uid muteState:(ByteRTCMuteState)muteState;

房间内某用户调用 muteLocalAudio: 改变本地音频发送状态时,房间内其他用户会收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
uid NSString* 改变本地音频发送状态的用户 ID
muteState ByteRTCMuteState 发送状态,参看 ByteRTCMuteState

rtcRoom:onUserStartAudioCapture:

- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onUserStartAudioCapture:(NSString *_Nonnull)userId;

房间内的用户调用 startAudioCapture 开启音频采集时,房间内其他用户会收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
userId NSString* 开启音频采集的远端用户 ID

rtcRoom:onUserStopAudioCapture:

- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onUserStopAudioCapture:(NSString *_Nonnull)userId;

房间内的用户调用 stopAudioCapture 关闭音频采集时,房间内其他用户会收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
userId NSString* 关闭音频采集的远端用户 ID

rtcRoom:onFirstLocalAudioFrame:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstLocalAudioFrame:(ByteRTCStreamIndex) streamIndex;

本地采集到第一帧音频帧时,收到该回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
streamIndex ByteRTCStreamIndex 音频流属性, 详见 ByteRTCStreamIndex

rtcRoom:onFirstRemoteAudioFrame:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstRemoteAudioFrame:(ByteRTCRemoteStreamKey * _Nonnull)key;

当收到远端流的第一帧音频的时候上报该事件

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
key ByteRTCRemoteStreamKey* 远端流信息, 详见 ByteRTCRemoteStreamKey

注意 用户刚收到房间内每一路音频流时,都会收到该回调。

rtcRoom:onStreamAdd:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onStreamAdd:(id<ByteRTCStream> _Nonnull)stream;

以下情况会触发此回调:

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
stream id 流属性,参看 ByteRTCStream 。

rtcRoom:didStreamRemoved:stream:reason:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom didStreamRemoved:(NSString *_Nonnull)uid stream:(id<ByteRTCStream> _Nonnull)stream reason:(ByteRTCStreamRemoveReason)reason;

房间内的远端用户停止发布音视频流时,本地用户会收到此回调通知。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象
uid NSString* 远端流来源的用户 ID 。
stream id 流的属性,参看 ByteRTCStream。
reason ByteRTCStreamRemoveReason 远端流移除的原因,参看 ByteRTCStreamRemoveReason 。

rtcRoom:onRoomMessageReceived:message:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageReceived:(NSString *_Nonnull)uid message:(NSString *_Nonnull)message;

收到房间中调用 sendRoomMessage: 发送的广播文本消息时,收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象
uid NSString* 消息发送者 ID 。
message NSString* 收到的文本消息内容。

rtcRoom:onRoomBinaryMessageReceived:message:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomBinaryMessageReceived:(NSString *_Nonnull)uid message:(NSData *_Nonnull)message;

收到房间中调用 sendRoomBinaryMessage: 发送的广播二进制消息时,收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象
uid NSString* 消息发送者 ID 。
message NSData* 收到的二进制消息内容。

rtcRoom:onUserMessageReceived:message:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserMessageReceived:(NSString *_Nonnull)uid message:(NSString *_Nonnull)message;

收到来自房间中其他用户通过 sendUserMessage:message: 发来的文本消息时(P2P),会收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象
uid NSString* 消息发送者的用户 ID 。
message NSString* 收到的文本消息内容。

rtcRoom:onUserBinaryMessageReceived:message:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserBinaryMessageReceived:(NSString *_Nonnull)uid message:(NSData *_Nonnull)message;

收到来自房间中其他用户通过 sendUserBinaryMessage:message: 发来的二进制消息时,会收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象
uid NSString* 消息发送者的用户 ID 。
message NSData* 收到的二进制消息内容。

rtcRoom:onUserMessageSendResult:error:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserMessageSendResult:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error;

向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
msgid int64_t 本条消息的 ID。
error ByteRTCUserMessageSendResult 消息发送结果,详见 ByteRTCUserMessageSendResult

注意

rtcRoom:onRoomMessageSendResult:error:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageSendResult:(int64_t)msgid error:(ByteRTCRoomMessageSendResult)error;

向房间内所有用户群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
msgid int64_t 本条消息的 ID。
error ByteRTCRoomMessageSendResult 消息发送结果,详见 ByteRTCRoomMessageSendResult

注意

rtcRoom:onLiveTranscodingResult:errorCode:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onLiveTranscodingResult:(NSString *_Nonnull)url errorCode:(ByteRTCTranscodingError)errorCode;

合流转推错误回调。
调用 startLiveTranscoding:observer: 接口或直接在服务端启动合流转推功能后,你会通过此回调收到启动结果和推流过程中的错误。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
url NSString* 推流地址的 URL。
errorCode ByteRTCTranscodingError 合流转推功能错误码,详见枚举类型 ByteRTCTranscodingError。

rtcRoom:onFirstLocalVideoFrameCaptured:withFrameInfo:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstLocalVideoFrameCaptured:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;

第一帧本地采集的视频/屏幕共享画面在本地视图渲染完成时,收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
streamIndex ByteRTCStreamIndex 流属性,参看 ByteRTCStreamIndex
frameInfo ByteRTCVideoFrameInfo* 视频帧信息,参看 ByteRTCVideoFrameInfo

rtcRoom:onLocalVideoSizeChanged:withFrameInfo:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onLocalVideoSizeChanged:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;

本地视频大小或旋转信息发生变化时,收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
streamIndex ByteRTCStreamIndex 流属性,参看 ByteRTCStreamIndex
frameInfo ByteRTCVideoFrameInfo* 视频帧信息,参看 ByteRTCVideoFrameInfo

rtcRoom:onRemoteVideoSizeChanged:withFrameInfo:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRemoteVideoSizeChanged:(ByteRTCRemoteStreamKey *_Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;

远端视频大小或旋转配置发生改变时,房间内订阅此视频流的用户会收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
streamKey ByteRTCRemoteStreamKey* 远端流信息。参看 ByteRTCRemoteStreamKey
frameInfo ByteRTCVideoFrameInfo* 视频帧信息。参看 ByteRTCVideoFrameInfo

rtcRoom:onFirstRemoteVideoFrameRendered:withFrameInfo:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onFirstRemoteVideoFrameRendered:(ByteRTCRemoteStreamKey *_Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;

第一帧远端视频流在视图上渲染成功后,收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
streamKey ByteRTCRemoteStreamKey* 远端流信息,参看 ByteRTCRemoteStreamKey
frameInfo ByteRTCVideoFrameInfo* 视频帧信息,参看 ByteRTCVideoFrameInfo

rtcRoom:onUserMuteVideo:withMuteState:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserMuteVideo:(NSString *_Nonnull)uid withMuteState:(ByteRTCMuteState)muteState;

房间内用户调用 muteLocalVideo: 暂停/恢复发送视频流时,房间内其他用户会收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
uid NSString* 暂停/恢复发送视频流的用户 ID。
muteState ByteRTCMuteState 暂停/恢复发送视频流。参看 ByteRTCMuteState

rtcRoom:onUserStartVideoCapture:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserStartVideoCapture:(NSString *_Nonnull)userId;

房间中用户调用 startVideoCapture 时,房间中其他用户会收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
userId NSString* 调用 startVideoCapture 接口的远端用户 ID

rtcRoom:onUserStopVideoCapture:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onUserStopVideoCapture:(NSString *_Nonnull)uid;

房间中远端用户调用 stopVideoCapture 时,本地用户将会收到该回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
uid NSString* 调用 stopVideoCapture 接口的远端用户 ID

rtcRoom:onLocalAudioStateChanged:error:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onLocalAudioStateChanged:(ByteRTCLocalAudioStreamState)state error:(ByteRTCLocalAudioStreamError)error;

本地音频流的状态发生改变时,收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
state ByteRTCLocalAudioStreamState 本地音频设备的当前状态,详见 ByteRTCLocalAudioStreamState
error ByteRTCLocalAudioStreamError 本地音频流状态改变时的错误码,详见 ByteRTCLocalAudioStreamError

rtcRoom:onRemoteAudioStateChanged:state:reason:

- (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

rtcRoom:onLocalVideoStateChanged:withStreamState:withStreamError:

- (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

rtcRoom:onRemoteVideoStateChanged:withVideoState:withVideoStateReason:

- (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

rtcRoom:onAudioFrameSendStateChanged:state:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onAudioFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;

音频首帧发送状态改变时,收到此回调。

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
user ByteRTCUser* 本地用户信息,详见 ByteRTCUser
state ByteRTCFirstFrameSendState 首帧发送状态,详见 ByteRTCFirstFrameSendState

rtcRoom:onVideoFrameSendStateChanged:state:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onVideoFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;

视频首帧发送状态改变时,收到此回调

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
user ByteRTCUser* 本地用户信息,详见 ByteRTCUser
state ByteRTCFirstFrameSendState 首帧发送状态,详见 ByteRTCFirstFrameSendState

rtcRoom:onScreenVideoFrameSendStateChanged:state:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onScreenVideoFrameSendStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state;

屏幕共享流视频首帧发送状态改变时,收到此回调

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
user ByteRTCUser* 本地用户信息,详见 ByteRTCUser
state ByteRTCFirstFrameSendState 首帧发送状态,详见 ByteRTCFirstFrameSendState

rtcRoom:onAudioFramePlayStateChanged:state:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onAudioFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;

音频首帧播放状态改变时,收到此回调

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
user ByteRTCUser* 音频流来源的用户信息,参看 ByteRTCUser
state ByteRTCFirstFramePlayState 首帧播放状态,详见 ByteRTCFirstFramePlayState

rtcRoom:onVideoFramePlayStateChanged:state:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onVideoFramePlayStateChanged:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state;

视频首帧播放状态改变时,收到此回调

传入参数

参数名 类型 说明
rtcRoom ByteRTCRoom* ByteRTCRoom 对象。
user ByteRTCUser* 视频流来源的用户信息,参看 ByteRTCUser
state ByteRTCFirstFramePlayState 首帧播放状态,详见 ByteRTCFirstFramePlayState

rtcRoom:onVideoStreamBanned:isBanned:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onVideoStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned;

通过调用服务端 MuteUser/UnmuteUser 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。

传入参数

参数名 类型 说明
uid NSString* 被禁用/解禁的视频流用户 ID
banned BOOL 视频流发送状态
• true: 视频流发送被禁用
• false: 视频流发送被解禁

注意

rtcRoom:onAudioStreamBanned:isBanned:

- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onAudioStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned;

通过调用服务端 MuteUser/UnmuteUser 方法禁用/解禁指定房间内指定用户视音频流的发送时,触发此回调。

传入参数

参数名 类型 说明
uid NSString* 被禁用/解禁的音频流用户 ID
banned BOOL 音频流发送状态
• true: 音频流发送被禁用
• false: 音频流发送被解禁

注意