Commit fa671759440d0c801188e8899ea53e4c90d44ada

Authored by zhangxiaowen
1 parent e49b9a9a

no message

CNLivePlayer/Classes/DataRequest/CNLivePlayerNetworkManager.h
... ... @@ -52,7 +52,7 @@ typedef void(^GetVideoURLSuccessBlock)(NSString * _Nullable videoURL, NSInteger
52 52 /**
53 53 * 获取视频url
54 54 */
55   -+ (void)getVideoURL:(nullable NSString *)URL success:(GetVideoURLSuccessBlock)success;
  55 +- (void)getVideoURL:(nullable NSString *)URL success:(GetVideoURLSuccessBlock)success;
56 56  
57 57  
58 58 @end
... ...
CNLivePlayer/Classes/DataRequest/CNLivePlayerNetworkManager.m
... ... @@ -177,8 +177,8 @@ static CNLivePlayerNetworkManager *_manager = nil;
177 177 /**
178 178 * 获取视频url
179 179 */
180   -+ (void)getVideoURL:(nullable NSString *)URL success:(GetVideoURLSuccessBlock)success {
181   - [CNLivePlayerNetworkManager manager].successBlock = success;
  180 +- (void)getVideoURL:(nullable NSString *)URL success:(GetVideoURLSuccessBlock)success {
  181 + _manager.successBlock = success;
182 182 _manager.result = NO;
183 183  
184 184 NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
... ...
CNLivePlayer/Classes/Player/CNLivePlayer.m
... ... @@ -264,6 +264,10 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
264 264 [self removeMovieNotificationObservers];
265 265 [self removeHostStatusNotificationObservers];
266 266  
  267 + if (PLAYER_TestEnvironment) {
  268 + NSLog(@"CNLivePlayer-->dealloc");
  269 + }
  270 +
267 271 }
268 272  
269 273 - (void)dealloc {
... ... @@ -315,7 +319,7 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
315 319 }else{
316 320 __weak typeof(self) weakSelf = self;
317 321 //4.不存在鉴权成功,先请求鉴权
318   - [weakSelf authenticateSuccess:^{
  322 + [self authenticateSuccess:^{
319 323 //5.鉴权成功,再请求url
320 324 __strong typeof(self) strongSelf = weakSelf;
321 325 if([strongSelf->_contentType isEqualToString:@"vod"]){
... ... @@ -405,9 +409,9 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
405 409 NSString *videoUrl = [CNLivePlayerTools encryptionSignWithUrl:vodUrl parameter:parameter];
406 410  
407 411 __weak typeof(self) weakSelf = self;
408   - [CNLivePlayerNetworkManager getVideoURL:videoUrl success:^(NSString * _Nullable videoURL, NSInteger code) {
  412 + [[CNLivePlayerNetworkManager manager] getVideoURL:videoUrl success:^(NSString * _Nullable videoURL, NSInteger code) {
409 413 __strong typeof(self) strongSelf = weakSelf;
410   - CNLivePlayerDBModel *model = [[CNLivePlayerDBModel alloc]initWithContenId:self->_contentId url:videoUrl];
  414 + CNLivePlayerDBModel *model = [[CNLivePlayerDBModel alloc]initWithContenId:self->_contentId url:videoURL];
411 415 [[CNLivePlayerDBTool shared] insertTable:model];
412 416  
413 417 __weak typeof(self) weakSelf = strongSelf;
... ... @@ -637,6 +641,7 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
637 641 if (!_preparedToPlay && !_statTimer) {
638 642 [self mediaIsPreparedToPlayDidChange:nil];
639 643 }
  644 +
640 645 }
641 646  
642 647 }
... ...
Example/CNLivePlayer/CNLivePlayerController.m
... ... @@ -34,7 +34,7 @@
34 34  
35 35 //1066_716fabeaafb64236b60ecf74167c5c96
36 36 //82_c8ff347048414b7295cef882f8361073
37   - _player = [[CNLivePlayer alloc]initAudioPlayerWithAudioId:@"82_c8ff347048414b7295cef882f8361073" authSuccess:^{
  37 + _player = [[CNLivePlayer alloc]initAudioPlayerWithAudioId:@"1066_716fabeaafb64236b60ecf74167c5c96" authSuccess:^{
38 38 NSLog(@"---------------初始化播放器成功---------------");
39 39 _player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0);
40 40  
... ... @@ -84,7 +84,7 @@
84 84 }
85 85  
86 86 - (void)btnDidClicked{
87   - [_player setPlayerWithContentId:@"1066_716fabeaafb64236b60ecf74167c5c96" type:CNLivePlayerVod authSuccess:^{
  87 + [_player setPlayerWithContentId:@"82_c8ff347048414b7295cef882f8361073" type:CNLivePlayerVod authSuccess:^{
88 88 [_player prepareToPlay];
89 89  
90 90 } authFailure:^(NSDictionary * _Nonnull errorInfo) {
... ...