NERtc iOS SDK  V5.3.1
NERtcEngineDelegate.h
浏览该文件的文档.
1 /*
2  * Copyright (c) 2021 NetEase, Inc. All rights reserved.
3  */
4 
5 #import <Foundation/Foundation.h>
7 #import "NERtcEngineEnum.h"
8 #import "NERtcEngineBase.h"
9 #import <CoreVideo/CoreVideo.h>
10 
11 #pragma clang diagnostic push
12 #pragma clang diagnostic ignored "-Wdocumentation"
13 
14 
15 NS_ASSUME_NONNULL_BEGIN
16 
25 @protocol NERtcEngineDelegate <NSObject>
26 
27 @optional
28 
43 - (void)onNERtcEngineDidError:(NERtcError)errCode;
44 
63 - (void)onNERtcEngineDidWarning:(NERtcWarning)warnCode msg:(NSString *)msg;
64 
65 - (void)onNERtcEngineApiDidExecuted:(NSString *)apiName errCode:(NERtcError)errCode msg:(NSString *)msg;
66 
81 - (void)onNERtcEngineConnectionStateChangeWithState:(NERtcConnectionStateType)state
82  reason:(NERtcReasonConnectionChangedType)reason;
83 
97 - (void)onNERtcEngineDidLeaveChannelWithResult:(NERtcError)result;
98 
115 - (void)onNERtcEngineDidDisconnectWithReason:(NERtcError)reason;
116 
129  - (void)onNERtcEngineRejoinChannel:(NERtcError)result;
130 
157  - (void)onNERtcEngineUserDidJoinWithUserID:(uint64_t)userID userName:(NSString *)userName;
158 
200 - (void)onNERtcEngineUserDidJoinWithUserID:(uint64_t)userID userName:(NSString *)userName joinExtraInfo:(nullable NERtcUserJoinExtraInfo *)joinExtraInfo;
201 
202 
226 - (void)onNERtcEngineUserDidLeaveWithUserID:(uint64_t)userID reason:(NERtcSessionLeaveReason)reason;
227 
270 - (void)onNERtcEngineUserDidLeaveWithUserID:(uint64_t)userID reason:(NERtcSessionLeaveReason)reason leaveExtraInfo:(nullable NERtcUserLeaveExtraInfo *)leaveExtraInfo;
271 
293 - (void)onNERtcEngineDidClientRoleChanged:(NERtcClientRole)oldRole newRole:(NERtcClientRole)newRole;
294 
306 
318 - (void)onNERtcEngineUserAudioDidStart:(uint64_t)userID;
319 
331 - (void)onNERtcEngineUserAudioDidStop:(uint64_t)userID;
332 
348 - (void)onNERtcEngineUserVideoDidStartWithUserID:(uint64_t)userID videoProfile:(NERtcVideoProfileType)profile;
349 
363 - (void)onNERtcEngineUserVideoDidStop:(uint64_t)userID;
364 
379 - (void)onNERtcEngineUserSubStreamDidStartWithUserID:(uint64_t)userID subStreamProfile:(NERtcVideoProfileType)profile;
380 
393 - (void)onNERtcEngineUserSubStreamDidStop:(uint64_t)userID;
394 
417 - (void)onNERtcEngineMediaRightChangeWithAudio:(BOOL)isAudioBannedByServer
418  video:(BOOL)isVideoBannedByServer;
419 
432 - (void)onNERtcEngineUserSubStreamAudioDidStart:(uint64_t)userID;
433 
446 - (void)onNERtcEngineUserSubStreamAudioDidStop:(uint64_t)userID;
447 
466 - (void)onNERtcEngineUser:(uint64_t)userID subStreamAudioMuted:(BOOL)muted;
467 
468 @end
469 
480 @protocol NERtcEngineLiveStreamObserver <NSObject>
481 
482 @optional
497 - (void)onNERTCEngineLiveStreamState:(NERtcLiveStreamStateCode)state taskID:(NSString *)taskID url:(NSString *)url;
498 
499 @end
500 
511 @protocol NERtcEngineVideoFrameObserver <NSObject>
512 
513 @optional
514 
531 - (void)onNERtcEngineVideoFrameCaptured:(CVPixelBufferRef)bufferRef rotation:(NERtcVideoRotationType)rotation;
532 
533 @end
534 
544 
545 @optional
546 //
547 //- (void)onNERtcEngineAudioDeviceInterruptionBegan;
548 //
549 //- (void)onNERtcEngineAudioDeviceInterruptionEnded;
550 
561 - (void)onNERtcEngineAudioDeviceRoutingDidChange:(NERtcAudioOutputRouting)routing;
562 
563 @end
564 
573 @protocol NERtcEngineVideoRenderSink <NSObject>
574 
575 @optional
588 - (void)onNERtcEngineRenderFrame:(NERtcVideoFrame *_Nonnull)frame;
589 
590 // 渲染所需的 buffer 类型,默认为 NERtcVideoBufferTypeRawData
592 
593 @end
604 @protocol NERtcEngineVideoSEIObserver <NSObject>
605 
606 @optional
607 
624 - (void)onNERtcEngineRecvSEIMsg:(uint64_t)userID message:(NSData *)message;
625 
626 @end
627 
628 @protocol NERtcEnginePreDecodeObserver <NSObject>
629  @optional
652 - (void)onNERtcEnginePreDecoderFrame:(NERtcPreDecoderFrameInfo *)preDecoderFrame;
653 
654 @end
655 
657 
658  @optional
659 
682 - (void)onNERtcEngineRequestSendKeyFrame:(NERtcStreamChannelType)videoStreamType;
683 
711 - (void)onNERtcEngineBitrateUpdated:(int)bitrateBps
712  videoStreamType:(NERtcStreamChannelType)videoStreamType;
713 
741 - (void)onNERtcEngineVideoCodecUpdated:(NERtcVideoCodecType)videoCodecType
742  videoStreamType:(NERtcStreamChannelType)videoStreamType;
743 
744 @end
745 
755 NERtcEngineVideoFrameObserver, // deprecated, USE setVideoFrameObserver:(id<NERtcEngineVideoFrameObserver>)videoframeObserver instead
759 
760 @optional
761 
776 - (void)onNERtcEngineUserVideoProfileDidUpdate:(uint64_t)userID maxProfile:(NERtcVideoProfileType)maxProfile;
777 
795 - (void)onNERtcEngineUser:(uint64_t)userID videoMuted:(BOOL)muted;
796 
827 - (void)onNERtcEngineUser:(uint64_t)userID videoMuted:(BOOL)muted streamType:(NERtcStreamChannelType)streamType;
828 
842 - (void)onNERtcEngineUser:(uint64_t)userID audioMuted:(BOOL)muted;
843 
858 - (void)onNERtcEngineFirstVideoDataDidReceiveWithUserID:(uint64_t)userID;
859 
885 - (void)onNERtcEngineFirstVideoDataDidReceiveWithUserID:(uint64_t)userID streamType:(NERtcStreamChannelType)streamType;
886 
897 - (void)onNERtcEngineFirstAudioDataDidReceiveWithUserID:(uint64_t)userID;
898 
910 - (void)onEngineFirstAudioFrameDecoded:(uint64_t)userID;
911 
930 - (void)onEngineFirstVideoFrameDecoded:(uint64_t)userID width:(uint32_t)width height:(uint32_t)height;
931 
967 - (void)onEngineFirstVideoFrameDecoded:(uint64_t)userID width:(uint32_t)width height:(uint32_t)height streamType:(NERtcStreamChannelType)streamType;
968 
983 - (void)onNERtcEngineAudioDeviceStateChangeWithDeviceID:(NSString *)deviceID deviceType:(NERtcAudioDeviceType)deviceType deviceState:(NERtcAudioDeviceState)deviceState;
984 
1003 - (void)onNERtcEngineVideoDeviceStateChangeWithDeviceID:(NSString *)deviceID deviceType:(NERtcVideoDeviceType)deviceType deviceState:(NERtcVideoDeviceState)deviceState;
1004 
1017 - (void)onNERtcEngineNetworkConnectionTypeChanged:(NERtcNetworkConnectionType)newConnectionType;
1018 
1040 - (void)onAudioMixingStateChanged:(NERtcAudioMixingState)state errorCode:(NERtcAudioMixingErrorCode)errorCode;
1041 
1054 - (void)onAudioMixingTimestampUpdate:(uint64_t)timeStampMS;
1055 
1056 
1068 - (void)onAudioEffectFinished:(uint32_t)effectId;
1069 
1097 - (void)onAudioEffectTimestampUpdateWithId:(uint32_t)effectId timeStampMS:(uint64_t)timeStampMS;
1098 
1117 - (void)onLocalAudioVolumeIndication:(int)volume;
1118 
1137 - (void)onLocalAudioVolumeIndication:(int)volume withVad:(BOOL)enableVad;
1138 
1139 
1162 -(void)onRemoteAudioVolumeIndication:(nullable NSArray<NERtcAudioVolumeInfo*> *)speakers totalVolume:(int)totalVolume;
1163 
1178 - (void)onNERtcEngineHardwareResourceReleased:(NERtcError)result;
1179 
1196 - (void)onNERtcCameraFocusChanged:(CGPoint)focusPoint;
1197 
1212 - (void)onNERtcCameraExposureChanged:(CGPoint)exposurePoint;
1213 
1214 
1215 
1229 
1242 - (void)onNERtcEngineChannelMediaRelayStateDidChange:(NERtcChannelMediaRelayState)state channelName:(NSString *)channelName;
1243 
1258 - (void)onNERtcEngineDidReceiveChannelMediaRelayEvent:(NERtcChannelMediaRelayEvent)event channelName:(NSString *)channelName error:(NERtcError)error;
1259 
1273 - (void)onNERtcEngineAudioRecording:(NERtcAudioRecordingCode)code filePath:(NSString *)filePath;
1274 
1275 
1296 - (void)onNERtcEngineLocalPublishFallbackToAudioOnly:(BOOL)isFallback streamType:(NERtcStreamChannelType)streamType;
1297 
1321 - (void)onNERtcEngineRemoteSubscribeFallbackToAudioOnly:(uint64_t)uid isFallback:(BOOL)isFallback streamType:(NERtcStreamChannelType)streamType;
1322 
1338 - (void)onNERtcEngineLastmileQuality:(NERtcNetworkQuality)quality;
1339 
1356 - (void)onNERtcEngineLastmileProbeTestResult:(NERtcLastmileProbeResult *)result;
1357 
1377 - (void)onNERtcEngineVirtualBackgroundSourceEnabled:(BOOL)enabled reason:(NERtcVirtualBackgroundSourceStateReason)reason;
1378 
1393 - (void)onNERtcEngineLocalVideoWatermarkStateWithStreamType:(NERtcStreamChannelType)type
1394  state:(NERtcLocalVideoWatermarkState)state;
1407 
1440 - (void)onNERtcEngineUpdatePermissionKey:(NSString *)key error:(NERtcError)error timeout:(NSUInteger)timeout;
1441 
1454 - (void)onNERtcEngineUserDataDidStart:(uint64_t)userID;
1455 
1466 - (void)onNERtcEngineUserDataDidStop:(uint64_t)userID;
1467 
1480 - (void)onNERtcEngineUserDataReceiveMessage:(uint64_t)userID data:(NSData *)data;
1481 
1492 - (void)onNERtcEngineUserDataStateChanged:(uint64_t)userID;
1493 
1506 - (void)onNERtcEngineUserDataBufferedAmountChanged:(uint64_t)userID previousAmount:(uint64_t)previousAmount;
1507 
1508 @end
1509 
1520 @protocol NERtcEngineAudioFrameObserver <NSObject>
1521 
1522 @optional
1523 
1542 - (void)onNERtcEngineAudioFrameDidRecord:(NERtcAudioFrame *)frame;
1543 
1544 
1563 - (void)onNERtcEngineAudioFrameWillPlayback:(NERtcAudioFrame *)frame;
1564 
1587 - (void)onNERtcEnginePlaybackAudioFrameBeforeMixingWithUserID:(uint64_t)userID frame:(NERtcAudioFrame *)frame;
1588 
1613 - (void)onNERtcEnginePlaybackAudioFrameBeforeMixingWithUserID:(uint64_t)userID frame:(NERtcAudioFrame *)frame channelId:(uint64_t)channelId;
1614 
1635 - (void)onNERtcEngineMixedAudioFrame:(NERtcAudioFrame *)frame;
1636 
1637 
1656 - (void)onNERtcEngineSubStreamAudioFrameDidRecord:(NERtcAudioFrame *)frame;
1657 
1680 - (void)onNERtcEnginePlaybackSubStreamAudioFrameBeforeMixingWithUserID:(uint64_t)userID frame:(NERtcAudioFrame *)frame channelId:(uint64_t)channelId;
1681 
1682 
1683 @end
1684 
1685 NS_ASSUME_NONNULL_END
1686 
1687 #pragma clang diagnostic pop
NERtcAudioMixingErrorCode
伴音错误码。
Definition: NERtcEngineEnum.h:2285
NERtcAudioDeviceState
音频设备状态。
Definition: NERtcEngineEnum.h:2811
NERtcVirtualBackgroundSourceStateReason
虚拟背景未成功启用的原因或确认成功的信息。
Definition: NERtcEngineEnum.h:1074
NERtcVideoBufferType
Definition: NERtcEngineEnum.h:990
NERtcChannelMediaRelayEvent
媒体流转发回调事件
Definition: NERtcEngineEnum.h:3027
NERtcChannelMediaRelayState
媒体流转发状态
Definition: NERtcEngineEnum.h:2980
NERtcVideoCodecType
Definition: NERtcEngineEnum.h:1888
NERtcAudioDeviceType
音频设备类型。
Definition: NERtcEngineEnum.h:2743
NERtcLocalVideoWatermarkState
视频水印状态。
Definition: NERtcEngineEnum.h:1256
NERtcAudioOutputRouting
音频路由。
Definition: NERtcEngineEnum.h:1392
NERtcAudioMixingState
伴音任务状态。
Definition: NERtcEngineEnum.h:2256
NERtcSessionLeaveReason
用户离开房间的原因。
Definition: NERtcEngineEnum.h:121
NERtcConnectionStateType
当前房间的连接状态。
Definition: NERtcEngineEnum.h:45
NERtcVideoProfileType
视频 profile 类型。
Definition: NERtcEngineEnum.h:395
NERtcNetworkConnectionType
网络连接的类型。
Definition: NERtcEngineEnum.h:2442
NERtcAudioRecordingCode
录音回调状态码。
Definition: NERtcEngineEnum.h:1774
NERtcNetworkQuality
网络质量类型。
Definition: NERtcEngineEnum.h:2906
NERtcVideoDeviceState
视频设备状态无限制,SDK 可以完全控制 Audio Session。
Definition: NERtcEngineEnum.h:2858
NERtcClientRole
用户角色。
Definition: NERtcEngineEnum.h:206
NERtcStreamChannelType
SEI发送的流通道类型。
Definition: NERtcEngineEnum.h:1043
NERtcLiveStreamStateCode
直播推流状态。
Definition: NERtcEngineEnum.h:2652
NERtcReasonConnectionChangedType
当前engine连接状态变更的原因。
Definition: NERtcEngineEnum.h:255
NERtcVideoDeviceType
视频设备类型。
Definition: NERtcEngineEnum.h:2781
NERtcVideoRotationType
视频数据的旋转方向
Definition: NERtcEngineEnum.h:951
NERtcError
Engine Error Code。
Definition: NERtcEngineErrorCode.h:17
NERtcWarning
Definition: NERtcEngineErrorCode.h:771
音频帧。
Definition: NERtcEngineBase.h:1492
声音音量信息。
Definition: NERtcEngineBase.h:1537
上下行 Last mile 网络质量探测结果。
Definition: NERtcEngineBase.h:2661
编码完的媒体数据帧
Definition: NERtcEngineBase.h:3017
onUserJoined 回调时的一些可选信息
Definition: NERtcEngineBase.h:2951
onUserLeave 回调时的一些可选信息
Definition: NERtcEngineBase.h:2963
视频帧信息。
Definition: NERtcEngineBase.h:1582
音频数据回调 如果需要对音频数据做处理,需要实现这个 protocol
Definition: NERtcEngineDelegate.h:1520
音频会话回调
Definition: NERtcEngineDelegate.h:543
NERtcEngine 常用回调
Definition: NERtcEngineDelegate.h:25
void onNERtcEngineReconnectingStart()
重连开始回调。 客户端和服务器断开连接时,SDK 会进行重连,重连开始时触发此回调。重连结果请参考 onNERtcEngineRejoinChannel 、onNERtcEngineDidDisconn...
NERtcEngine 扩展回调。
Definition: NERtcEngineDelegate.h:758
void onNERtcEnginePermissionKeyWillExpire()
权限密钥即将过期事件回调。
void onNERtcEngineAudioHasHowling()
检测到啸叫回调。 当声源与扩音设备之间因距离过近时,可能会产生啸叫。NERTC SDK 支持啸叫检测,当检测到有啸叫信号产生的时候,自动触发该回调直至啸叫停止。App 应用层可以在收到啸叫回调时,提示用...
直播推流状态回调 如果需要监听直播推流状态,需要实现这个 protocol
Definition: NERtcEngineDelegate.h:480
Definition: NERtcEngineDelegate.h:628
Definition: NERtcEngineDelegate.h:656
本地视频数据采集回调 如果需要对采集数据做美颜等处理,需要实现这个 protocol。
Definition: NERtcEngineDelegate.h:511
外部视频渲染。
Definition: NERtcEngineDelegate.h:573
NERtcVideoBufferType getFrameBufferType()
注册 SEI 观测者。 注册观测者并拉流成功后,当远端流发送 SEI,本端会收到 onNERtcEngineRecvSEIMsg 回调。
Definition: NERtcEngineDelegate.h:604