萤石云 iOSSDK,移植跨平台相关工程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
//
//  EZBAVClient.h
//  EZBAVClient
//
//  Created by kanhaiping on 2018/6/26.
//  Copyright © 2018年 hikvision. All rights reserved.
//
 
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "EZBAVParam.h"
#import "EZRTCMediaSessionDefines.h"
#import "EZVideoTalkView.h"
 
 
 
@class EZConferenceClient;
@class EZRTCCameraParam;
@class EZRTCVideoEncodeParam;
 
@protocol EZConferenceClientDelegate<NSObject>
 
 
/// 错误回调
/// @param client client
/// @param errorCode 出错的错误码
- (void)bavClient:(EZConferenceClient *)client didReceivedError:(int32_t)errorCode;
 
/**
 回调消息
 
 @param client client
 @param messageCode 消息码 参见EZBAVMessage
 @param msg 附加信息,
    如果是EZBAVMessagePeerEnteredRoom,msg是EZRTCParticipantsInfo对象,但是只有m_uClientId、m_szUserName字段有效
    如果是EZBAVMessagePeerLeaveRoom消息,msg是EZRTCParticipantsInfo对象,但是只有m_uClientId字段有效
    如果是EZBAVMessageClientVolume消息,msg是EZBAVParticipantVolume对象
    如果消息是 EZBAVMessageTransferData msg是 msg是字符串 @"实际的透传消息"
    如果消息是EZBAVMessageClientAudioAvailable,msg是EZRTCParticipantsInfo对象,但是只有m_uClientId和audioState字段有效
    如果消息是EZBAVMessageClientVideoAvailable ,msg是EZRTCParticipantsInfo对象,但是只有m_uClientId和videoState字段有效
    如果消息是EZBAVMessageNetworkQuality ,msg是EZRTCParticipantsInfo对象,但是只有m_uClientId和netState字段有效
    如果消息是EZBAVMessageJoinRoomOK ,msg是nil
    如果消息是EZBAVMessageForcedQuit ,msg是NSNumber,比如@(EZBAVForcedQuitReasonMovedOut)
    如果消息是EZBAVMessageStatistic,msg是EZRTCStatistic
 
 */
- (void)bavClient:(EZConferenceClient *)client didReceivedMessage:(int32_t)messageCode msg:(id)msg;
 
@optional
 
///**
// 回调消息 bavclient log回调
//
// @param client client
// @param msg 透传消息
// */
//- (void)bavClient:(EZVideoTalk *)client didReceivedBavClientLogMsg:(NSString*)msg;
 
/**
 显示回调,首次画面出来以及后续画面尺寸发生变化时回调
 
 @param client client
 @param width 画面宽度
 @param height 画面高度
 */
- (void)bavClient:(EZConferenceClient *)client didDisplayWidth:(int32_t)width height:(int32_t)height ofRemoteClient:(int)clientID;
 
/**
 播放卡顿
 
 @param client client
 @param delayTime 卡顿时间
 */
- (void)bavClient:(EZConferenceClient *)client playDelayTime:(int32_t)delayTime ofRemoteClient:(int)clientID;
 
/**
 播放卡顿统计
 
 @param client client
 @param delayTimeStat 卡顿时间
 */
- (void)bavClient:(EZConferenceClient *)client playDelayTimeStatistics:(double)delayTimeStat ofRemoteClient:(int)clientID;
 
/**
 本地视频数据回调
 
 @param localVideoStatistics 视频相关参数
 @param width    宽度
 @param height  高度
 */
- (void)onLocalVideoStats:(EZRTCLocalStatistics *)localVideoStatistics width:(int)width height:(int)height;
 
/**
 本地音频数据回调
 
 @param localAudioStatistics 音频相关参数
 */
- (void)onLocalAudioStats:(EZRTCLocalStatistics *)localAudioStatistics;
 
/**
 远端视频数据回调
 
 @param remoteVideoStatistics 视频相关参数
 @param width    宽度
 @param height  高度
 */
- (void)onRemoteVideoStats:(EZRTCRemoteStatistics *)remoteVideoStatistics width:(int)width height:(int)height;
 
/**
 远端音频数据回调
 
 @param remoteAudioStatistics 音频相关参数
 */
- (void)onRemoteAudioStats:(EZRTCRemoteStatistics *)remoteAudioStatistics;
 
 
@end
 
@interface EZConferenceClient : NSObject
 
@property (nonatomic, weak) id<EZConferenceClientDelegate> delegate;
@property (nonatomic, assign, readonly) int32_t roomID;
@property (nonatomic, assign, readonly) int32_t clientID;
 
 
/**
 对讲时,强制采用扬声器播放声音,默认为YES
 */
@property (nonatomic, assign) BOOL forceToSpeaker;
 
 
/// 初始化视频通话SDK对象
- (instancetype)init;
 
/// 加入会议(新接口)
/// @param param 参数
- (NSInteger)enterRoom:(EZRTCJoinParam *)param;
 
 
/// 退出会议
- (NSInteger)exitRoom;
 
 
/// 解散会议,解散后,其他与会者会收到会议被解散消息
- (void)dissolveRoom;
 
/// 本地摄像头开启/关闭接口
/// @param enable 是否开启摄像头
- (NSInteger)enableLocalVideo:(BOOL)enable;
 
/// 设置本地的预览窗口
/// @param localWin 窗口window
- (void)setLocalView:(nullable EZVideoTalkView *)localWin;
 
/// 本地麦克风开启/关闭接口
/// @param enable 是否开启麦克风
/// @param block 主线程回调结果
- (void)enableLocalAudio:(BOOL)enable withResultBlock:(EZAudioOpenResultBlock)block;
 
/// 是否开启辅流,辅流分辨率更低、码率更小
/// @param enable 是否开启
/// @param encodeParam 编码参数,可以传入nil
- (NSInteger)enableLocalSmallVideo:(BOOL)enable;
 
 
/// 开启屏幕共享
/// @param name 共享名称
/// @param resultBlock 屏幕共享结果回调
/// @param didFinishBlock 屏幕共享结束回调,在正常的屏幕共享结束结束后回调
- (void)startScreenShareWithName:(NSString *)name
                 withResultBlock:(EZScreenShareResultBlock)resultBlock
                   andEndedBlock:(dispatch_block_t)didFinishBlock;
 
 
/// 结束屏幕共享
- (void)stopScreenShare;
 
 
/// 设置远程窗口,1.必须在拿到远端客户端加入的消息后设置,2.必须在主线程调用
/// @param window 播放窗口
/// @param clientID 加入的客户端的ID
/// @param streamType 1视频 4小流
- (int32_t)setRemoteView:(nullable UIView *)window ofClient:(int32_t)clientID withStream:(NSInteger)streamType;
 
/// 设置观看屏幕共享的窗口,必须在主线程调用
/// @param view 窗口
- (int32_t)setScreenShareView:(UIView *_Nullable)view;
 
 
/// 邀请设备加入会议
/// @param dev 设备信息
- (int32_t)inviteDev:(EZBAVDevInfo *_Nonnull)dev;
 
 
/// 切换对讲时使用的摄像头,默认采用前置 同步接口
/// @param backCameraSelected YES:选择后置,NO:选择前置
- (int32_t)switchCamera:(BOOL)backCameraSelected;
 
 
- (EZRTCStatistic *_Nullable)getStatistic;
 
#pragma 附加接口
 
/// 开关会议中某个与会者的声音,默认开
/// @param open YES:开,NO:关
- (int32_t)soundCtrl:(BOOL)open forClient:(int32_t)clientID;
 
 
 
/// 异步获取本地抓图
/// @param block 抓图成功回调,失败image为nil
//- (void)localScreenShotWithBlock:(void (^)(UIImage *image))block;
 
/// 获取远端抓图
/// @param quality 压缩质量 0 ~ 100
//- (UIImage *)remoteScreenShotWithQuality:(int)quality;
 
/// 本地录制
/// @param path 写入的沙盒路径
- (BOOL)startLocalVideoRecordWithPath:(NSString *)path;
 
/// 停止本地录制
- (BOOL)stopLocalVideoRecord;
 
/// 开始远端录制 mp4
/// @param path 写入的沙盒路径
- (BOOL)startRemoteVideoRecordWithPath:(NSString *)path  forClient:(int32_t)clientID;
 
 
/// 停止远端录制
- (BOOL)stopRemoteVideoRecordForClient:(int32_t)clientID;
 
 
/// 发送透传消息接口,同步接口,可能耗时
/// @param msg 消息内容,比如json数据
- (int)sendTransferMsg:(NSString *)msg;
 
@end