@protocol ByteRTCVideoSinkProtocol <NSObject>
自定义的视频渲染
| 返回 | 名称 |
|---|---|
| BOOL | shouldInitialize |
| void | shouldStart |
| void | shouldStop |
| void | shouldDispose |
| ByteRTCVideoSinkPixelFormat | pixelFormat |
| void | renderPixelBuffer:rotation:extendedData: |
- (BOOL)shouldInitialize;
初始化渲染器
返回值
注意 初始化渲染器的时候会回调这个方法
- (void)shouldStart;
启动渲染器
注意 在开启渲染功能的时候会回调这个方法
- (void)shouldStop;
停止渲染器
注意 在停止渲染功能的时候会回调这个方法
- (void)shouldDispose;
释放渲染器
注意 渲染器即将被废弃的时候会回调这个方法
- (ByteRTCVideoSinkPixelFormat)pixelFormat;
获取PixelFormat格式
返回值 Buffer 类型,ByteRTCVideoSinkPixelFormat
注意 通过该方法的返回值,告知 SDK PixelFormat 的格式
- (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(ByteRTCVideoRotation)rotation extendedData:(NSData * _Nullable)extendedData;
输出视频的 PixelBuffer
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pixelBuffer | CVPixelBufferRef | 视频的 PixelBuffer |
| rotation | ByteRTCVideoRotation | 视频旋转角度,ByteRTCVideoRotation |
| extendedData | NSData* | 视频帧附加的数据,视频解码后获得的附加数据 |
注意 通过该方法获取视频的 PixelBuffer
@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 ByteRTCLocalEncodedVideoFrameObserver<NSObject>
本地视频帧监测器
| 返回 | 名称 |
|---|---|
| void | onLocalEncodedVideoFrame:Frame: |
- (void)onLocalEncodedVideoFrame:(ByteRTCStreamIndex) streamIndex Frame:(ByteRTCEncodedVideoFrame * _Null_unspecified)frame;
调用 RegisterLocalEncodedVideoFrameObserver:ByteRTCEngineKit@RegisterLocalEncodedVideoFrameObserver: 后,SDK 收到本地视频帧信息时,回调该事件
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 本地视频帧类型,参看 ByteRTCStreamIndex |
| frame | ByteRTCEncodedVideoFrame* _Null_unspecified | 本地视频帧信息,参看 ByteRTCEncodedVideoFrame |
@protocol LiveTranscodingDelegate <NSObject>
合流转推观察者。
| 返回 | 名称 |
|---|---|
| BOOL | isSupportClientPushStream |
| void | onStreamMixingEvent:eventData:error:mixType: |
| void | onMixingAudioFrame: |
| void | onMixingVideoFrame: |
| void | onMixingDataFrame: |
- (BOOL)isSupportClientPushStream;
是否具有推流能力。
注意
- (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 |
- (void)onMixingAudioFrame:(ByteRTCAudioFrame *_Nonnull)audioFrame;
端云一体合流音频 PCM 回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | PCM 合流音频数据帧,详见 ByteRTCAudioFrame |
注意
- (void)onMixingVideoFrame:(ByteRTCVideoFrame *_Nonnull)videoFrame;
端云一体合流视频 YUV 回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| videoFrame | ByteRTCVideoFrame* | YUV 合流视频数据帧,详见 ByteRTCVideoFrame |
注意
- (void)onMixingDataFrame:(ByteRTCFrameExtendedData *_Nonnull)dataFrame;
端云一体合流视频 SEI 数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| dataFrame | ByteRTCFrameExtendedData* | SEI 数据,详见 ByteRTCFrameExtendedData |
@protocol ByteRTCEngineDelegate <NSObject>
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onWarning:(ByteRTCWarningCode)Code;
发生警告回调。
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 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 onJoinRoomResult:(NSString *_Nonnull)roomId withUid:(nonnull NSString *)uid errorCode:(NSInteger)errorCode joinType:(NSInteger)joinType elapsed:(NSInteger)elapsed;
首次加入房间/重连加入房间的回调,表示用户调用 joinRoomByKey:roomId:roomProfile:userInfo:
的结果,根据错误码判断成功/失败以及区别是否为重连。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| roomId | NSString* | 房间 ID。 |
| uid | NSString* | 用户 ID。 |
| errorCode | NSInteger | 用户加入房间回调的状态码。参看 ByteRTCErrorCode 以及 ByteRTCWarningCode。 |
| joinType | NSInteger | 加入房间的类型。 |
| elapsed | NSInteger | 重连耗时。本地用户从连接断开到重连成功所经历的时间间隔,单位为 ms 。 |
返回值
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onUserJoined:(nonnull ByteRTCUserInfo *)userInfo elapsed:(NSInteger)elapsed;
远端主播角色用户加入房间回调。
1.远端主播角色用户调用 joinRoomByKey:roomId:roomProfile:userInfo: 方法加入房间时,房间内其他用户将收到该事件。
2.远端主播角色用户断网后重新连入房间时,房间内其他用户将收到该事件。
3.远端静默观众角色用户调用 setUserRole: 方法将角色切换至主播时,房间内其他用户将收到该事件。
4.新进房用户会收到进房前已在房内的主播角色用户的进房回调通知。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| userInfo | ByteRTCUserInfo* | 用户信息。参看 ByteRTCUserInfo。 |
| elapsed | NSInteger | 保留字段 |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason;
远端主播角色用户离开房间回调。
发生以下情形时,房间内其他用户会收到此事件:
1.远端主播角色用户调用 leaveRoom: 方法离开房间时。
2.远端主播角色用户调用 setUserRole: 方法将角色切换至静默观众。
3.远端主播角色用户断网,且一直未恢复。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| uid | NSString* | 离开房间的远端用户 ID 。 |
| reason | ByteRTCUserOfflineReason | 用户离开房间的原因,参看 ByteRTCUserOfflineReason。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMuteAudio:(NSString * _Nonnull)uid muteState:(ByteRTCMuteState)muteState;
房间内某用户调用 muteLocalAudio: 改变本地音频发送状态时,房间内其他用户会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| uid | NSString* | 改变本地音频发送状态的用户 ID |
| muteState | ByteRTCMuteState | 发送状态,详见 ByteRTCMuteState |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine didLocalAudioEnabled:(BOOL)enabled byUid:(NSString * _Nonnull)uid;
远端用户开启/关闭音频设备采集回调 提示有远端用户已开启/关闭音频设备采集,该回调由远端用户调用 startAudioCapture 方法触发
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit对象 |
| enabled | BOOL | YES: 该用户开启了音频设备采集;NO: 该用户关闭了音频设备采集 |
| uid | NSString* | 远端用户ID • 该接口已废弃,请使用 rtcEngine:onUserStartAudioCapture: 以及 rtcEngine:onUserStopAudioCapture: |
- (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 onAudioVolumeIndication:(NSArray<ByteRTCAudioVolumeInfo *> * _Nonnull)speakers totalRemoteVolume:(NSInteger)totalRemoteVolume;
提示本地采集的音量信息和在房间内订阅的远端用户的音量信息。
本回调默认不开启。你可以通过调用 setAudioVolumeIndicationInterval: 开启。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| speakers | NSArray |
本地用户和订阅的远端用户的 ID 和音量。 参看 ByteRTCAudioVolumeInfo。 |
| totalRemoteVolume | NSInteger | speakers 中包含的所有音频音量之和,取值范围是 [0,255]。 |
注意
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMuteVideo:(NSString * _Nonnull)uid withMuteState:(ByteRTCMuteState)muteState;
房间内用户暂停/恢复发送视频流时,房间内其他用户会收到此回调。参看 muteLocalVideo:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| uid | NSString* | 暂停/恢复发送视频流的用户 ID。 |
| muteState | ByteRTCMuteState | 暂停/恢复发送视频流。参看 ByteRTCMuteState |
- (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* | 调用 stopVideoCapture 接口的远端用户ID |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstLocalVideoFrameCaptured:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo;
第一帧本地采集的视频/屏幕共享画面在本地视图渲染完成时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex:ByteRTCStreamIndex |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo:ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onFirstRemoteVideoFrameRendered:(ByteRTCRemoteStreamKey * _Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo;
第一帧远端视频流在视图上渲染成功后,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息,参看 ByteRTCRemoteStreamKey:ByteRTCRemoteStreamKey |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo:ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRemoteVideoSizeChanged:(ByteRTCRemoteStreamKey *_Nonnull)streamKey withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
远端视频大小或旋转信息发生变化时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamKey | ByteRTCRemoteStreamKey* | 流属性,参看 ByteRTCRemoteStreamKey:ByteRTCRemoteStreamKey |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo:ByteRTCVideoFrameInfo |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLocalVideoSizeChanged:(ByteRTCStreamIndex)streamIndex withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo;
本地视频大小或旋转信息发生变化时,收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex:ByteRTCStreamIndex |
| frameInfo | ByteRTCVideoFrameInfo* | 视频帧信息,参看 ByteRTCVideoFrameInfo:ByteRTCStreamIndex |
- (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 didMirrorStateChanged:(BOOL)mirrored;
本地视频镜像状态发生改变回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| mirrored | BOOL | 当前是否开启镜像 • true:当前本地视频状态为开启镜像 • false:当前本地视频状态为关闭镜像 |
- (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 |
- (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;
视频首帧发送状态改变回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| 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;
屏幕共享流视频首帧播放状态改变回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| 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 onStreamAdd:(id <ByteRTCStream> _Nonnull)stream;
房间内的用户发布新的音视频流时,房间内的其他用户会收到此回调通知。包括移除后又重新发布的流。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| stream | id |
流的属性,参看 ByteRTCStream 数据类型。 |
- (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 。 |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onAudioPlaybackDeviceChanged:(ByteRTCAudioPlaybackDevice)device;
音频播放设备变化时,收到该回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| device | ByteRTCAudioPlaybackDevice | 新的音频设备,详见 ByteRTCAudioPlaybackDevice |
注意 音频设备设置与音频路由策略,详见 setAudioPlaybackDevice:
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRoomMessageReceived:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message;
收到房间中广播文本消息时(Broadcast),会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例。 |
| uid | NSString* | 消息发送者 ID 。 |
| message | NSString* | 收到的文本消息内容。 |
注意
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onRoomBinaryMessageReceived:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message;
房间内所有用户接收到广播二进制消息的回调。(Broadcast)。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| uid | NSString* | 消息发送者 ID 。 |
| message | 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;
通话中本地设备接收订阅的远端音/视频流的统计信息以及网络状况,每 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:ByteRTCStreamIndex |
| state | ByteRTCLocalVideoStreamState | 本地视频流状态,参看 ByteRTCLocalVideoStreamState:ByteRTCLocalVideoStreamState |
| error | ByteRTCLocalVideoStreamError | 本地视频状态改变时的错误码,参看 ByteRTCLocalVideoStreamError:ByteRTCLocalVideoStreamError |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onRemoteVideoStateChanged:(ByteRTCRemoteStreamKey*_Nonnull)streamKey withVideoState:(ByteRTCRemoteVideoState)state withVideoStateReason:(ByteRTCRemoteVideoStateChangeReason)reason;
远端视频流的状态发生改变时,房间内订阅此流的用户会收到该事件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| streamKey | ByteRTCRemoteStreamKey* | 远端视频流信息,房间、用户 ID、流属性等,参看 ByteRTCRemoteStreamKey:ByteRTCRemoteStreamKey |
| state | ByteRTCRemoteVideoState | 远端视频流状态,参看 ByteRTCRemoteVideoState:ByteRTCRemoteStreamKey |
| reason | ByteRTCRemoteVideoStateChangeReason | 远端视频流状态改变的原因,参看 ByteRTCRemoteVideoStateChangeReason:ByteRTCRemoteVideoStateChangeReason |
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserMessageReceived:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message;
收到来自房间中其他用户发来的文本消息时(P2P),会收到此回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前 RTCEngine 实例。 |
| uid | NSString* | 消息发送者 ID 。 |
| message | NSString* | 收到的文本消息内容。 |
注意
- (void)rtcEngine:(ByteRTCEngineKit * _Nonnull)engine onUserBinaryMessageReceived:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message;
单个用户接收到同一房间内其他 uid 所属用户发来二进制消息的回调(P2P)。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| 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;
向房间内所有用户发送文本或二进制消息后(Broadcast),消息发送方会收到该消息发送结果回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象 |
| msgid | int64_t | 本条消息的 ID。 |
| error | ByteRTCRoomMessageSendResult | 文本或二进制消息发送结果,详见 ByteRTCRoomMessageSendResult |
注意
- (void)rtcEngine:(ByteRTCEngineKit* _Nonnull)engine log:(NSDictionary* _Nonnull)dict;
SDK 内部日志回调。
SDK 内部运行时,会把日志回调给业务方,方便排查问题。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | ByteRTCEngineKit 对象。 |
| dict | NSDictionary* | 日志内容。 |
- (void)rtcEngineLocalAudioMixingDidFinish:(ByteRTCEngineKit *_Nonnull)engine;
音乐文件混音结束回调。SDK通过此回调通知应用层音乐文件混音结束。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前RTC SDK对象 |
- (void)rtcEngineDidAudioEffectFinish:(ByteRTCEngineKit *_Nonnull)engine soundId:(NSInteger)soundId;
音效文件混音结束回调。SDK通过此回调通知应用层音效文件混音结束
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | 当前RTC SDK对象 |
| soundId | NSInteger | 音效ID |
- (void)rtcEngine:(ByteRTCEngineKit *_Nonnull)engine onLiveTranscodingResult:(NSString *_Nonnull)url errorCode:(ByteRTCTranscodingError)errorCode;
合流转推错误回调。
调用 startLiveTranscoding:observer: 接口或直接在服务端启动合流转推功能后,你会通过此回调收到启动结果和推流过程中的错误。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| engine | ByteRTCEngineKit* | engine 实例 |
| url | NSString* | 推流地址的 URL。 |
| errorCode | ByteRTCTranscodingError | 合流转推功能错误码,详见枚举类型 ByteRTCTranscodingError。 |
- (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* | 远端的连接地址 |
@protocol ByteRTCAudioFrameObserver <NSObject>
音频数据代理
| 返回 | 名称 |
|---|---|
| void | onRecordAudioFrame: |
| void | onPlaybackAudioFrame: |
| void | onMixedAudioFrame: |
- (void)onRecordAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;
返回麦克风录制的音频数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 麦克风录制的音频数据, 详见: ByteRTCAudioFrame |
- (void)onPlaybackAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;
返回远端所有用户混音后的音频数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 远端所有用户混音后的音频数据, 详见: ByteRTCAudioFrame |
- (void)onMixedAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame;
返回本地麦克风录制和远端所有用户混音后的音频数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 本地麦克风录制和远端所有用户混音后的音频数据, 详见: ByteRTCAudioFrame |
@protocol ByteRTCMediaMetadataObserver <NSObject>
使用内部源视频采集时,配置和获取附加数据接口
| 返回 | 名称 |
|---|---|
| NSData* | videoFrameMediaMetaDataAtTime: |
| void | receiveVideoFrameFromUID:withExtendedData:atTimestamp: |
- (NSData *_Nullable)videoFrameMediaMetaDataAtTime:(NSTimeInterval)timestamp;
当 SDK 准备发送一个视频帧时,会回调该接口,以确定是否需要在该视频帧中添加 metadata
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| timestamp | NSTimeInterval | 待添加 metadata 视频帧的时间戳,单位微秒 |
返回值 待发送的数据,大小不能超过 1024bytes
注意
- (void)receiveVideoFrameFromUID:(NSString * _Nonnull)uid withExtendedData:(NSData* _Nullable)extendedData atTimestamp:(NSTimeInterval)timestamp;
当 SDK 收到的视频帧包含 medatada 时,会回调该接口
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 当前帧所属的用户ID |
| extendedData | NSData* | metadata |
| timestamp | NSTimeInterval | 包含 metadata 视频帧的时间戳,单位为微秒 |
注意 回调中不能做长时间逻辑处理,以免影响视频卡顿
@protocol ByteRTCEncryptHandler <NSObject>
自定义加密接口
| 返回 | 名称 |
|---|---|
| NSData* | ByteRTCEncryptRawData: |
| NSData* | ByteRTCDecryptRawData: |
- (NSData * _Nonnull) ByteRTCEncryptRawData:(NSData * _Nonnull)rawData;
自定义加密。
使用设定的自定义加密方式,对传输前的音视频帧数据进行加密。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rawData | NSData* | 原始音视频帧数据 |
返回值 加密后的数据
注意
- (NSData * _Nonnull) ByteRTCDecryptRawData:(NSData * _Nonnull)rawData;
自定义解密。
对自定义加密后的音视频帧数据进行解密。关于自定义加密,参看 ByteRTCEncryptRawData:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rawData | NSData* | 收到的已加密的音视频帧数据 |
返回值 解密后的数据
注意
@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;
输出更多的调试信息