QNRTCEngineDelegate
QNRTCSessionDelegate 提供连麦相关的所有回调,包括但不限于远端连麦者加入(离开)房间、发布(取消发布)音视频以及连麦状态等回调
方法
RTCEngine:didFailWithError:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didFailWithError:(NSError *)error;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
error | 错误信息 |
说明
SDK 运行过程中出现错误的回调,具体错误码的含义可查阅 QNRTCErrorDomain。
RTCEngine:roomStateDidChange:
定义
- (void)RTCEngine:(QNRTCEngine *)engine roomStateDidChange:(QNRoomState)roomState;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
roomState | 房间状态 |
说明
房间状态变化的回调。房间状态变更的逻辑可点此查阅。
RTCEngine:didPublishLocalTracks:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didPublishLocalTracks:(NSArray<QNTrackInfo *> *)tracks;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
tracks | 成功发布的 tracks |
说明
本地音/视频 Track 成功发布的回调。
RTCEngine:didJoinOfRemoteUserId:userData:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didJoinOfRemoteUserId:(NSString *)userId userData:(NSString *)userData;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
userId | 加入房间的 userId |
userData | 该 userId 对应的 userData |
说明
远端用户加入房间的回调。
RTCEngine:didLeaveOfRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didLeaveOfRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
userId | 离开房间的 userId |
说明
远端用户离开房间的回调。
RTCEngine:didSubscribeTracks:ofRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didSubscribeTracks:(NSArray<QNTrackInfo *> *)tracks ofRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
tracks | 成功订阅的 tracks |
userId | 成功订阅的 userId |
说明
订阅远端用户成功的回调。
RTCEngine:didSubscribeProfileChanged:ofRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didSubscribeProfileChanged:(NSArray<QNTrackInfo *> *)tracks ofRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
tracks | profile 发生改变的 tracks |
userId | profile 发生改变的 userId |
说明
订阅远端用户 profile 发生改变的回调。
RTCEngine:didPublishTracks:ofRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didPublishTracks:(NSArray<QNTrackInfo *> *)tracks ofRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
tracks | 远端用户发布的 tracks |
userId | 远端用户的 userId |
说明
远端用户发布音/视频的回调。
RTCEngine:didUnPublishTracks:ofRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didUnPublishTracks:(NSArray<QNTrackInfo *> *)tracks ofRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
tracks | 远端用户取消发布的 tracks |
userId | 远端用户的 userId |
说明
远端用户取消发布音/视频的回调。
RTCEngine:didKickoutByUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didKickoutByUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
userId | 操作踢出功能的 userId |
说明
被 userId 踢出房间的回调。
RTCEngine:didAudioMuted:ofTrackId:byRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didAudioMuted:(BOOL)muted ofTrackId:(NSString *)trackId byRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
muted | 变更后的 mute 状态 |
trackId | 当前操作的 trackId |
userId | 远端用户的 userId |
说明
远端用户音频状态变更为 muted 的回调。
RTCEngine:didVideoMuted:ofTrackId:byRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didVideoMuted:(BOOL)muted ofTrackId:(NSString *)trackId byRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
muted | 变更后的 mute 状态 |
trackId | 当前操作的 trackId |
userId | 远端用户的 userId |
说明
远端用户视频状态变更为 muted 的回调。
RTCEngine:firstVideoDidDecodeOfTrackId:remoteUserId:
定义
- (QNVideoRender *)RTCEngine:(QNRTCEngine *)engine firstVideoDidDecodeOfTrackId:(NSString *)trackId remoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
trackId | 当前的 trackId |
userId | 远端用户的 userId |
说明
远端用户视频首帧解码后的回调。如果需要渲染,则需要返回一个带 renderView 的 QNVideoRender 对象,这里的 renderView
是 QNVideoView
类。
RTCEngine:didDetachRenderView:ofTrackId:remoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didDetachRenderView:(UIView *)renderView ofTrackId:(NSString *)trackId remoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
renderView | 停止渲染的 View |
trackId | 当前的 trackId |
userId | 远端用户的 userId |
说明
远端用户视频取消渲染到 renderView 上的回调。
RTCEngine:didGetPixelBuffer:ofTrackId:remoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didGetPixelBuffer:(CVPixelBufferRef)pixelBuffer ofTrackId:(NSString *)trackId remoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
pixelBuffer | 视频数据 |
trackId | 当前的 trackId |
userId | 远端用户的 userId |
说明
远端用户视频数据的回调。回调远端用户视频数据会带来一定的性能消耗,如果没有相关需求,不要实现该回调。
RTCEngine:didGetAudioBuffer:bitsPerSample:sampleRate:ofTrackId:remoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine
didGetAudioBuffer:(AudioBuffer *)audioBuffer
bitsPerSample:(NSUInteger)bitsPerSample
sampleRate:(NSUInteger)sampleRate
ofTrackId:(NSString *)trackId
remoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
audioBuffer | 远端用户的音频数据(PCM 格式) |
bitsPerSample | PCM 数据的位宽 |
sampleRate | 音频数据的采样率 |
trackId | 当前的 trackId |
userId | 远端用户 Id |
说明
远端用户音频数据的回调。回调远端用户音频数据会带来一定的性能消耗,如果没有相关需求,请不要实现该回调。
RTCEngine:cameraSourceDidGetSampleBuffer:
定义
- (void)RTCEngine:(QNRTCEngine *)engine cameraSourceDidGetSampleBuffer:(CMSampleBufferRef)sampleBuffer;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
sampleBuffer | 摄像头原数据 |
说明
摄像头原数据时的回调,便于开发者做滤镜等处理,需要注意的是这个回调在 camera 数据的输出线程,请不要做过于耗时的操作,否则可能会导致编码帧率下降。
RTCEngine:microphoneSourceDidGetAudioBuffer:
定义
- (void)RTCEngine:(QNRTCEngine *)engine microphoneSourceDidGetAudioBuffer:(AudioBuffer *)audioBuffer;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
audioBuffer | 麦克风原数据 |
说明
麦克风原数据时的回调。需要注意的是这个回调在 AU Remote IO 线程,请不要做过于耗时的操作,否则可能阻塞该线程影响音频输出或其他未知问题。
RTCEngine:microphoneSourceDidGetAudioBuffer:asbd:
定义
- (void)RTCEngine:(QNRTCEngine *)engine microphoneSourceDidGetAudioBuffer:(AudioBuffer *)audioBuffer asbd:(const AudioStreamBasicDescription *)asbd;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
audioBuffer | 麦克风原数据 |
asbd | 用于描述回调的数据格式 |
说明
麦克风原数据时的回调。需要注意的是这个回调在 AU Remote IO 线程,请不要做过于耗时的操作,否则可能阻塞该线程影响音频输出或其他未知问题。注意,当接入蓝牙耳机等外置设备时,采样率可能发生改变,具体值可从 asbd 中获取。
RTCEngine:didGetStatistic:ofTrackId:userId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine
didGetStatistic:(NSDictionary *)statistic
ofTrackId:(NSString *)trackId
userId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 的实例 |
statistic | 统计信息 |
trackId | 当前的 trackId |
userId | 远端用户的 Id |
说明
统计信息的回调。统计信息回调的时间间隔由 statisticInterval
参数决定,默认为 0秒,即不回调统计信息。
RTCEngine:volume:ofTrackId:userId;
定义
- (void)RTCEngine:(QNRTCEngine *)engine volume:(float)volume ofTrackId:(NSString *)trackId userId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 的实例 |
volume | 音量大小,范围 [0, 1] |
trackId | 当前的 trackId |
userId | 远端用户的 Id |
说明
用户音量回调,包括本地和远端。注意:回调用户音量会带来一定的性能消耗,如果没有相关需求,请不要实现该回调。
RTCEngine:didCreateMergeStreamWithJobId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didCreateMergeStreamWithJobId:(NSString *)jobId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
jobId | 合流任务的 id |
说明
成功创建合流任务的回调。
RTCEngine:didChangeAudioOutputToDevice:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didChangeAudioOutputToDevice:(QNAudioDeviceType)deviceType;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
deviceType | 音频输出设备的类型,具体定义可查看 QNAudioDeviceType |
说明
音频输出设备变更的回调。主动调用的 - (void)setSpeakerOn:(BOOL)speakerOn;
不会有该回调。
RTCEngine:didReceiveMessage:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didReceiveMessage:(QNMessageInfo *)message;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
message | 收到的消息 |
说明
收到消息的回调。
RTCEngine:didLeaveOfLocalSuccess:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didLeaveOfLocalSuccess:(BOOL)success;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
success | 离开房间是否成功 |
说明
本地用户离开房间成功的回调。
RTCEngine:didCreateForwardJobWithJobId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didCreateForwardJobWithJobId:(NSString *)jobId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
jobId | 单路转推任务 jobId |
说明
成功创建单路转推任务的回调
RTCEngine:didReconnectingRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didReconnectingRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
userId | 发生重连的 userId |
说明
远端用户发生重连的回调
RTCEngine:didReconnectedRemoteUserId:
定义
- (void)RTCEngine:(QNRTCEngine *)engine didReconnectedRemoteUserId:(NSString *)userId;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
userId | 重连成功的 userId |
说明
远端用户重连成功的回调
RTCEngine:roomMediaRelayStateDidChange:
定义
- (void)RTCEngine:(QNRTCEngine *)engine roomMediaRelayStateDidChange:(NSDictionary *)state;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
state | 跨房间媒体流转发状态 |
说明
跨房间媒体流转发状态发生改变的回调。
RTCEngine:didClientRoleChanged:newRole:
定义
- (void)RTCEngine:(QNRTCEngine *_Nonnull)engine didClientRoleChanged:(QNClientRole)oldRole newRole:(QNClientRole)newRole;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
oldRole | 用户原始角色 |
newRole | 用户当前角色 |
说明
用户角色已切换的回调。
RTCEngine:remoteTrackMixedDidGetAudioBuffer:
定义
- (void)RTCEngine:(QNRTCEngine *)engine remoteTrackMixedDidGetAudioBuffer:(AudioBuffer *)audioBuffer;
参数
参数名 | 描述 |
---|---|
engine | QNRTCEngine 实例 |
audioBuffer | 音频数据 |
说明
远端音频 Track 混合后的数据的回调。需要注意的是这个回调在 AU Remote IO 线程,请不要做过于耗时的操作,否则可能阻塞该线程影响音频输出或其他未知问题。