Commit f55b052195e97e45017a059087ceb2a7710205a8

Authored by 雷浩杰
1 parent 5f6e63d2

no message

CNLivePlayerSDKTest/CNLivePlayerSDK.framework/CNLivePlayerSDK
No preview for this file type
CNLivePlayerSDKTest/CNLivePlayerSDK.framework/Headers/CNLiveGPUStreamerKit.h
... ... @@ -82,24 +82,7 @@
82 82 @abstract 启动推流
83 83 @warning 鉴权成功后开启推流
84 84 */
85   -- (void) startStream:(void (^)(void))success failure:(void (^)(NSError *error))failure;
86   -
87   -/**
88   - @abstract 推流过程中异常通知
89   - */
90   -FOUNDATION_EXPORT NSString *const CNLiveStreamAbnormalNotification NS_AVAILABLE_IOS(7_0);
91   -
92   -/**
93   - @abstract 结束推流成功
94   - */
95   -FOUNDATION_EXPORT NSString *const CNLiveStreamStopSuccessNotification NS_AVAILABLE_IOS(7_0);
96   -
97   -/**
98   - @abstract 结束推流失败
99   - */
100   -FOUNDATION_EXPORT NSString *const CNLiveStreamStopFailedNotification NS_AVAILABLE_IOS(7_0);
101   -
102   -
  85 +- (void) startStream:(void (^)(void))successBlock failure:(void (^)(NSDictionary *errorDic))failureBlock;
103 86  
104 87 #pragma mark - 普通推流
105 88  
... ...
CNLivePlayerSDKTest/CNLivePlayerSDK.framework/Headers/CNLiveTypeDef.h
... ... @@ -82,6 +82,10 @@ typedef NS_ENUM(NSUInteger, CNLiveStreamState) {
82 82 CNLiveStreamStateDisconnecting,
83 83 /// 推流出错
84 84 CNLiveStreamStateError,
  85 + /// 结束推流成功
  86 + CNLiveStopStreamSuccess,
  87 + /// 结束推流失败
  88 + CNLiveStopStreamFailure,
85 89 };
86 90  
87 91 /*!
... ... @@ -124,6 +128,8 @@ typedef NS_ENUM(NSUInteger, CNLiveStreamErrorCode) {
124 128 CNLiveStreamErrorCode_FRAMES_THRESHOLD,
125 129 /// 没有输入的数据,无法开始推流
126 130 CNLiveStreamErrorCode_NO_INPUT_SAMPLE,
  131 + /// 异常
  132 + CNLiveStreamErrorCode_ABNORMAL,
127 133 };
128 134  
129 135 #endif /* CNLiveTypeDef_h */
... ...
CNLivePlayerSDKTest/CNLivePlayerSDK.framework/Info.plist
No preview for this file type
CNLivePlayerSDKTest/CNLivePlayerSDKTest.xcodeproj/project.pbxproj
... ... @@ -7,6 +7,9 @@
7 7 objects = {
8 8  
9 9 /* Begin PBXBuildFile section */
  10 + 3236EF121DEEE1C800BF905D /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3236EF111DEEE1C800BF905D /* CNLivePlayerSDK.framework */; };
  11 + 32ACF8B41DEEE1D4003247CD /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3236EF111DEEE1C800BF905D /* CNLivePlayerSDK.framework */; };
  12 + 32ACF8B51DEEE1D4003247CD /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3236EF111DEEE1C800BF905D /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
10 13 32B4C85A1D9B66A400925AF0 /* CNLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B4C8591D9B66A400925AF0 /* CNLiveViewController.m */; };
11 14 32B4C85D1D9B66E500925AF0 /* StreamerDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B4C85C1D9B66E500925AF0 /* StreamerDetailViewController.m */; };
12 15 32E6CA2B1D5B0AF400B58EBC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 32E6CA2A1D5B0AF400B58EBC /* main.m */; };
... ... @@ -19,8 +22,6 @@
19 22 32E6CA921D5B2AF700B58EBC /* NormalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32E6CA881D5B2AF700B58EBC /* NormalViewController.m */; };
20 23 32E6CA931D5B2AF700B58EBC /* PlayerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32E6CA8A1D5B2AF700B58EBC /* PlayerViewController.m */; };
21 24 32E6CA951D5B2AF700B58EBC /* StreamerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32E6CA8F1D5B2AF700B58EBC /* StreamerViewController.m */; };
22   - 32F437DF1DC9E03300A074BE /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F437DE1DC9E03300A074BE /* CNLivePlayerSDK.framework */; };
23   - 32F437E11DC9E04900A074BE /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 32F437DE1DC9E03300A074BE /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
24 25 /* End PBXBuildFile section */
25 26  
26 27 /* Begin PBXCopyFilesBuildPhase section */
... ... @@ -30,7 +31,7 @@
30 31 dstPath = "";
31 32 dstSubfolderSpec = 10;
32 33 files = (
33   - 32F437E11DC9E04900A074BE /* CNLivePlayerSDK.framework in Embed Frameworks */,
  34 + 32ACF8B51DEEE1D4003247CD /* CNLivePlayerSDK.framework in Embed Frameworks */,
34 35 );
35 36 name = "Embed Frameworks";
36 37 runOnlyForDeploymentPostprocessing = 0;
... ... @@ -38,6 +39,7 @@
38 39 /* End PBXCopyFilesBuildPhase section */
39 40  
40 41 /* Begin PBXFileReference section */
  42 + 3236EF111DEEE1C800BF905D /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; };
41 43 32B4C8581D9B66A400925AF0 /* CNLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveViewController.h; sourceTree = "<group>"; };
42 44 32B4C8591D9B66A400925AF0 /* CNLiveViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveViewController.m; sourceTree = "<group>"; };
43 45 32B4C85B1D9B66E500925AF0 /* StreamerDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamerDetailViewController.h; sourceTree = "<group>"; };
... ... @@ -60,7 +62,6 @@
60 62 32E6CA8A1D5B2AF700B58EBC /* PlayerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlayerViewController.m; sourceTree = "<group>"; };
61 63 32E6CA8E1D5B2AF700B58EBC /* StreamerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamerViewController.h; sourceTree = "<group>"; };
62 64 32E6CA8F1D5B2AF700B58EBC /* StreamerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StreamerViewController.m; sourceTree = "<group>"; };
63   - 32F437DE1DC9E03300A074BE /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; };
64 65 /* End PBXFileReference section */
65 66  
66 67 /* Begin PBXFrameworksBuildPhase section */
... ... @@ -68,7 +69,8 @@
68 69 isa = PBXFrameworksBuildPhase;
69 70 buildActionMask = 2147483647;
70 71 files = (
71   - 32F437DF1DC9E03300A074BE /* CNLivePlayerSDK.framework in Frameworks */,
  72 + 3236EF121DEEE1C800BF905D /* CNLivePlayerSDK.framework in Frameworks */,
  73 + 32ACF8B41DEEE1D4003247CD /* CNLivePlayerSDK.framework in Frameworks */,
72 74 );
73 75 runOnlyForDeploymentPostprocessing = 0;
74 76 };
... ... @@ -78,7 +80,7 @@
78 80 32E6CA1D1D5B0AF400B58EBC = {
79 81 isa = PBXGroup;
80 82 children = (
81   - 32F437DE1DC9E03300A074BE /* CNLivePlayerSDK.framework */,
  83 + 3236EF111DEEE1C800BF905D /* CNLivePlayerSDK.framework */,
82 84 32E6CA281D5B0AF400B58EBC /* CNLivePlayerSDKTest */,
83 85 32E6CA271D5B0AF400B58EBC /* Products */,
84 86 );
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Streamer/StreamerDetailViewController.m
... ... @@ -140,9 +140,9 @@
140 140 _kitCN.activityName = @"iOStest";
141 141  
142 142 [_kitCN startStream:^{
143   - NSLog(@"success");
144   - } failure:^(NSError *error) {
145   - [self toast:error.localizedDescription];
  143 + NSLog(@"开启推流成功 ------- success");
  144 + } failure:^(NSDictionary *errorDic) {
  145 + [self toast:errorDic[@"errorMessage"]];
146 146 }];
147 147  
148 148 }else{
... ... @@ -203,55 +203,27 @@
203 203 selector:@selector(streamStateChange)
204 204 name:CNLiveStreamStateDidChangeNotification
205 205 object:nil];
206   -
207   - [[NSNotificationCenter defaultCenter] addObserver:self
208   - selector:@selector(abnormalState)
209   - name:CNLiveStreamAbnormalNotification
210   - object:nil];
211   -
212   - [[NSNotificationCenter defaultCenter] addObserver:self
213   - selector:@selector(streamStopSuccess)
214   - name:CNLiveStreamStopSuccessNotification
215   - object:nil];
216   -
217   - [[NSNotificationCenter defaultCenter] addObserver:self
218   - selector:@selector(streamStopFailed)
219   - name:CNLiveStreamStopFailedNotification
220   - object:nil];
221 206 }
222 207  
223 208 #pragma mark - notification
224   -- (void)streamStopSuccess
225   -{
226   - NSLog(@"---------CNLiveStreamStopSuccess");
227   -}
228   -
229   -- (void)streamStopFailed
230   -{
231   - NSLog(@"---------CNLiveStreamStopFailed");
232   -}
233   -
234 209 - (void)captureStateChange
235 210 {
236 211  
237 212 if ( _kitCN.captureState == CNLiveCaptureStateIdle){
238 213 //初始化时状态为空闲
239   - NSLog(@"---------CNLiveCaptureStateIdle");
240   - _stateLab.text = @"idle";
  214 + _stateLab.text = @"CNLiveCaptureStateIdle";
241 215  
242 216 return;
243 217 }
244 218 else if (_kitCN.captureState == CNLiveCaptureStateCapturing ) {
245 219 //设备工作中
246   - NSLog(@"---------CNLiveCaptureStateCapturing");
247   - _stateLab.text = @"capturing";
  220 + _stateLab.text = @"CNLiveCaptureStateCapturing";
248 221  
249 222 return;
250 223 }
251 224 else if (_kitCN.captureState == CNLiveCaptureStateClosingCapture ) {
252 225 //关闭采集设备中
253   - NSLog(@"---------CNLiveCaptureStateClosingCapture");
254   - _stateLab.text = @"closing capture";
  226 + _stateLab.text = @"CNLiveCaptureStateClosingCapture";
255 227  
256 228 return;
257 229 }
... ... @@ -279,19 +251,20 @@
279 251  
280 252 - (void)streamStateChange
281 253 {
  254 +
282 255 if (_kitCN.streamState == CNLiveStreamStateIdle) {
283 256 NSLog(@"---------CNLiveStreamStateIdle");
284   - _stateLab.text = @"idle";
  257 + _stateLab.text = @"CNLiveStreamStateIdle";
285 258 }
286 259  
287 260 if (_kitCN.streamState == CNLiveStreamStateConnected) {
288 261 NSLog(@"---------CNLiveStreamStateConnected");
289   - _stateLab.text = [NSString stringWithFormat:@"connected------%@",_hostURL];
  262 + _stateLab.text = [NSString stringWithFormat:@"CNLiveStreamStateConnected------%@",_hostURL];
290 263 }
291 264  
292 265 if (_kitCN.streamState == CNLiveStreamStateConnecting) {
293 266 NSLog(@"---------CNLiveStreamStateConnecting");
294   - _stateLab.text = @"kit connecting";
  267 + _stateLab.text = @"CNLiveStreamStateConnecting";
295 268 }
296 269  
297 270 //推流出错
... ... @@ -303,7 +276,21 @@
303 276 //断开推流
304 277 if ( _kitCN.streamState == CNLiveStreamStateDisconnecting) {
305 278 NSLog(@"---------CNLiveStreamStateDisconnecting");
306   - _stateLab.text = @"disconnecting";
  279 + _stateLab.text = @"CNLiveStreamStateDisconnecting";
  280 +
  281 + }
  282 +
  283 + //结束推流成功
  284 + if ( _kitCN.streamState == CNLiveStopStreamSuccess) {
  285 + NSLog(@"---------CNLiveStopStreamSuccess");
  286 + _stateLab.text = @"CNLiveStopStreamSuccess";
  287 +
  288 + }
  289 +
  290 + //结束推流成功
  291 + if ( _kitCN.streamState == CNLiveStopStreamFailure) {
  292 + NSLog(@"---------CNLiveStopStreamSuccess");
  293 + _stateLab.text = @"CNLiveStopStreamFailure";
307 294  
308 295 }
309 296 }
... ... @@ -323,8 +310,14 @@
323 310 else if ( CNLiveStreamErrorCode_CONNECT_BREAK == err) {
324 311 _stateLab.text = @"Connection break";
325 312 }
  313 + else if ( CNLiveStreamErrorCode_ABNORMAL == err) {
  314 + _stateLab.text = @"Connection break";
  315 + }
326 316 else {
327   -
  317 + [self toast:@"推流异常中断~~"];
  318 + NSLog(@"---------推流异常中断~~");
  319 + [_startLiveBtn setTitle:@"开始直播" forState:UIControlStateNormal];
  320 + _startLiveBtn.selected = NO;
328 321 }
329 322 NSLog(@"onErr: %lu [%@]", (unsigned long) err, _stateLab.text);
330 323 // 断网重连
... ... @@ -336,9 +329,9 @@
336 329 if (_isAuthLive) {
337 330  
338 331 [_kitCN startStream:^{
339   - NSLog(@"success");
340   - } failure:^(NSError *error) {
341   - [self toast:error.localizedDescription];
  332 + NSLog(@"开启推流成功 ------- success");
  333 + } failure:^(NSDictionary *errorDic) {
  334 + [self toast:errorDic[@"errorMessage"]];
342 335 }];
343 336  
344 337 }else{
... ... @@ -348,14 +341,6 @@
348 341 }
349 342 }
350 343  
351   -- (void)abnormalState
352   -{
353   - [self toast:@"推流异常中断~~"];
354   - NSLog(@"---------推流异常中断~~");
355   - [_startLiveBtn setTitle:@"开始直播" forState:UIControlStateNormal];
356   - _startLiveBtn.selected = NO;
357   -}
358   -
359 344 //对焦
360 345 - (void)onTap:(UIGestureRecognizer *)sender
361 346 {
... ...
推流SDK文档.pdf
No preview for this file type
播放SDK文档.pdf
No preview for this file type