NERtcCallKit for iOS V3.1.0
载入中...
搜索中...
未找到
NERtcCallKit.h
浏览该文件的文档.
1// Copyright (c) 2022 NetEase, Inc. All rights reserved.
2// Use of this source code is governed by a MIT license that can be
3// found in the LICENSE file.
4
5#import <Foundation/Foundation.h>
6
7#import <UIKit/UIKit.h>
8#import "NECallEngine.h"
10#import "NEGroupCallKit.h"
15#import "NERtcCallOptions.h"
16// #import "NERtcCallKitDelegate.h"
17
19// FOUNDATION_EXPORT double NERtcCallKitVersionNumber;
20
22// FOUNDATION_EXPORT const unsigned char NERtcCallKitVersionString[];
23
24// In this header, you should import all the public headers of your framework using statements like
25// #import <NERtcCallKit/PublicHeader.h>
26
27NS_ASSUME_NONNULL_BEGIN
28
29typedef void (^NERtcCallKitRecordMessageHander)(V2NIMMessage *message);
30
31@protocol NERtcCallKitDelegate <NSObject>
32
33@optional
34
41- (void)onInvited:(NSString *)invitor
42 userIDs:(NSArray<NSString *> *)userIDs
43 isFromGroup:(BOOL)isFromGroup
44 groupID:(nullable NSString *)groupID
45 type:(NERtcCallType)type
46 NERtcCallKitDeprecate("use -onInvited:userIDs:isFromGroup:groupID:type:attachment: instead");
47
54- (void)onInvited:(NSString *)invitor
55 userIDs:(NSArray<NSString *> *)userIDs
56 isFromGroup:(BOOL)isFromGroup
57 groupID:(nullable NSString *)groupID
58 type:(NERtcCallType)type
59 attachment:(nullable NSString *)attachment;
60
63- (void)onUserEnter:(NSString *)userID;
64
67- (void)onUserReject:(NSString *)userID;
68
71- (void)onUserCancel:(NSString *)userID;
72
75- (void)onUserLeave:(NSString *)userID;
76
79- (void)onUserDisconnect:(NSString *)userID;
80
83- (void)onUserAccept:(NSString *)userID;
84
87- (void)onUserBusy:(NSString *)userID;
88
92- (void)onCallTypeChange:(NERtcCallType)callType withState:(NERtcSwitchState)state;
93
96- (void)onCallTypeChange:(NERtcCallType)callType
97 NERtcCallKitDeprecate("use -onCallTypeChange:withState: instead");
98
100- (void)onCallEnd;
101
103- (void)onCallingTimeOut;
104
107- (void)onDisconnect:(NSError *)reason;
108
110- (void)onError:(NSError *)error;
111
115- (void)onCameraAvailable:(BOOL)available userID:(NSString *)userID;
116
120- (void)onAudioAvailable:(BOOL)available userID:(NSString *)userID;
121
125- (void)onVideoMuted:(BOOL)muted userID:(NSString *)userID;
126
130- (void)onAudioMuted:(BOOL)muted userID:(NSString *)userID;
131
134- (void)onJoinChannel:(NERtcCallKitJoinChannelEvent *)event;
135
140- (void)onFirstVideoFrameDecoded:(NSString *)userID width:(uint32_t)width height:(uint32_t)height;
141
144- (void)onUserNetworkQuality:(NSDictionary<NSString *, NERtcNetworkQualityStats *> *)stats;
145
147- (void)onOtherClientAccept;
148
150- (void)onOtherClientReject;
151
153- (void)onNERtcEngineUser:(uint64_t)userID videoMuted:(BOOL)muted;
154
155- (void)onNERtcEngineUserVideoDidStartWithUserID:(uint64_t)userID
156 videoProfile:(NERtcVideoProfileType)profile;
157
158- (void)onRtcInitEnd;
159
160@end
161
162@interface NERtcCallKit : NSObject
163
165@property(nonatomic, assign, readonly) NERtcCallStatus callStatus;
166
168@property(nonatomic, assign) NSTimeInterval timeOutSeconds;
169
171@property(nonatomic, copy, nullable) NERtcCallKitTokenHandler tokenHandler;
172
174@property(nonatomic, copy, nullable) NERtcCallKitPushConfigHandler pushConfigHandler;
175
177@property(nonatomic, copy, nullable) NERtcCallKitRecordMessageHander recordHandler;
178
180@property(nonatomic, weak) id<NERtcEngineDelegateEx> engineDelegate;
181
183@property(nonatomic, weak) id<NERtcEngineMediaStatsObserver> observer;
184
186+ (instancetype)sharedInstance;
187
190- (void)setupAppKey:(NSString *)appKey options:(nullable NERtcCallOptions *)options;
191
197- (void)setupAppKey:(NSString *)appKey
198 withRtcUid:(uint64_t)rtcUid
199 options:(nullable NERtcCallOptions *)options;
200
205- (void)setupAppKey:(NSString *)appKey
206 options:(nullable NERtcCallOptions *)options
207 withContext:(nonnull NERtcEngineContext *)context;
208
213- (void)login:(NSString *)userID
214 token:(NSString *)token
215 completion:(nullable void (^)(NSError *_Nullable error))completion;
216
219- (void)updateApnsToken:(NSData *)deviceToken;
220
223- (void)updatePushKitToken:(NSData *)pushkitToken;
224
226- (void)logout:(nullable void (^)(NSError *_Nullable error))completion;
227
232- (void)call:(NSString *)userID
233 type:(NERtcCallType)type
234 completion:(nullable void (^)(NSError *_Nullable error))completion;
235
241- (void)call:(NSString *)userID
242 type:(NERtcCallType)type
243 attachment:(nullable NSString *)attachment
244 completion:(nullable void (^)(NSError *_Nullable error))completion;
245
252- (void)call:(NSString *)userID
253 type:(NERtcCallType)type
254 attachment:(nullable NSString *)attachment
255 globalExtra:(nullable NSString *)extra
256 completion:(nullable void (^)(NSError *_Nullable error))completion;
257
266- (void)call:(NSString *)userID
267 type:(NERtcCallType)type
268 attachment:(nullable NSString *)attachment
269 globalExtra:(nullable NSString *)extra
270 withToken:(nullable NSString *)token
271 channelName:(nullable NSString *)channelName
272 completion:(nullable void (^)(NSError *_Nullable error))completion;
273
276- (void)cancel:(nullable void (^)(NSError *_Nullable error))completion;
277
280- (void)accept:(nullable void (^)(NSError *_Nullable error))completion;
281
285- (void)acceptWithToken:(nullable NSString *)token
286 withCompletion:(nullable void (^)(NSError *_Nullable error))completion;
287
290- (void)reject:(nullable void (^)(NSError *_Nullable error))completion;
291
295- (void)rejectWithReason:(NSInteger)reason
296 withCompletion:(nullable void (^)(NSError *_Nullable error))completion;
297
300- (void)hangup:(nullable void (^)(NSError *_Nullable error))completion;
301
305- (void)setupLocalView:(nullable UIView *)localView;
306
311- (void)setupRemoteView:(nullable UIView *)remoteView forUser:(nullable NSString *)userID;
312
316- (int)enableLocalVideo:(BOOL)enable;
317
321- (int)muteLocalVideo:(BOOL)muted;
322
325- (int)switchCamera;
326
330- (int)muteLocalAudio:(BOOL)mute;
331
338- (void)switchCallType:(NERtcCallType)type
339 withState:(NERtcSwitchState)state
340 completion:(nullable void (^)(NSError *_Nullable error))completion;
341
345- (void)setLoudSpeakerMode:(BOOL)speaker error:(NSError *_Nonnull *_Nonnull)error;
346
352- (void)setAudioMute:(BOOL)mute forUser:(NSString *)userID error:(NSError *_Nonnull *_Nonnull)error;
353
357- (void)memberOfUid:(uint64_t)uid
358 completion:(nullable void (^)(NIMSignalingMemberInfo *_Nullable info))completion;
359
363- (void)memberOfAccid:(NSString *)accid
364 completion:(nullable void (^)(NIMSignalingMemberInfo *_Nullable info))completion;
365
368- (void)addDelegate:(id<NERtcCallKitDelegate>)delegate;
369
372- (void)removeDelegate:(id<NERtcCallKitDelegate>)delegate;
373
377- (void)enableSwitchCallTypeConfirmVideo:(BOOL)video audio:(BOOL)audio;
378
380+ (NSString *)versionCode;
381
382@end
383
384NS_ASSUME_NONNULL_END
void(^ NERtcCallKitTokenHandler)(uint64_t uid, NSString *channelName, void(^complete)(NSString *token, NSError *error))
定义 NECallEngineConsts.h:133
NERtcCallStatus
通话状态
定义 NECallEngineConsts.h:41
NERtcSwitchState
通话行为
定义 NECallEngineConsts.h:108
void(^ NERtcCallKitPushConfigHandler)(NERtcCallKitPushConfig *config, NERtcCallKitContext *context)
定义 NECallEngineConsts.h:136
NS_ASSUME_NONNULL_BEGIN typedef void(^ NERtcCallKitRecordMessageHander)(V2NIMMessage *message)
Project version number for NERtcCallKit.
定义 NERtcCallKit.h:163
NERtcCallKitRecordMessageHander recordHandler
话单自定义回调,如果需要修发送话单内容可以在此回调中修改message相关字段
定义 NERtcCallKit.h:177
NSTimeInterval timeOutSeconds
单位:秒,IM服务器邀请2分钟后无响应为超时,最大值不超过2分钟。
定义 NERtcCallKit.h:168
id< NERtcEngineDelegateEx > engineDelegate
NERtcEngine 的回调接口,由用户提供
定义 NERtcCallKit.h:180
instancetype sharedInstance()
单例
定义 NERtcCallKit.m:57
NSString * versionCode()
版本号
定义 NERtcCallKit.m:349
id< NERtcEngineMediaStatsObserver > observer
中转NERtcEngine统计回调
定义 NERtcCallKit.h:183
NERtcCallStatus callStatus
通话状态
定义 NERtcCallKit.h:165
NERtcCallKitPushConfigHandler pushConfigHandler
推送配置定制化,修改config.pushTitle,config.pushContent来完成。需要的上下文内容在context对象中提供。
定义 NERtcCallKit.h:174
int switchCamera()
切换摄像头
NERtcCallKitTokenHandler tokenHandler
安全模式音视频房间token获取,nil表示非安全模式. Block中一定要调用complete
定义 NERtcCallKit.h:171
定义 NERtcCallKitJoinChannelEvent.h:10
定义 NERtcCallOptions.h:10