Commit 79b8cafa3445723ec7cca77d9ae08cec5ec8058f

Authored by zhangxiaowen
1 parent f969a1ba

no message

CNLivePlayer/Classes/Player/CNLivePlayer.m
... ... @@ -69,7 +69,6 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
69 69 [self addMovieNotificationObservers];
70 70  
71 71 self.player = [[KSYMoviePlayerController alloc] initWithContentURL:url];
72   -
73 72 [self.view addSubview:_player.view];
74 73 _player.view.frame = self.view.bounds;
75 74 _player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
... ... @@ -271,8 +270,7 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
271 270 }
272 271  
273 272 - (void)dealloc {
274   - [self destroyPlayer];
275   -
  273 +
276 274 }
277 275  
278 276 #pragma mark - 查找本地是否有缓存url
... ...
Example/CNLivePlayer/CNLivePlayerController.m
... ... @@ -34,21 +34,24 @@
34 34  
35 35 //1066_716fabeaafb64236b60ecf74167c5c96
36 36 //82_c8ff347048414b7295cef882f8361073
37   - _player = [[CNLivePlayer alloc]initAudioPlayerWithAudioId:@"1066_716fabeaafb64236b60ecf74167c5c96" authSuccess:^{
  37 + __weak typeof(self) weakSelf = self;
  38 + self.player = [[CNLivePlayer alloc]initAudioPlayerWithAudioId:@"1066_716fabeaafb64236b60ecf74167c5c96" authSuccess:^{
38 39 NSLog(@"---------------初始化播放器成功---------------");
39   - _player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0);
  40 + __strong typeof(self) strongSelf = weakSelf;
  41 + strongSelf.player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0);
40 42  
41   - [_player prepareToPlay];
42   - [self.view addSubview:_player.view];
  43 + [strongSelf.player prepareToPlay];
  44 + [strongSelf.view addSubview:weakSelf.player.view];
43 45  
44   - NSLog(@"-----%@", _player.contentURL);
  46 + NSLog(@"-----%@", strongSelf.player.contentURL);
45 47  
46 48  
47 49 } authFailure:^(NSDictionary * _Nonnull errorInfo) {
48 50 NSLog(@"%@", errorInfo);
49 51  
50 52 }];
51   -
  53 + _player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0);
  54 +
52 55 UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
53 56 btn.frame =CGRectMake(0, 0, 100, 100);
54 57 btn.center = self.view.center;
... ... @@ -80,7 +83,6 @@
80 83  
81 84 - (void)dealloc{
82 85 [_player destroyPlayer];
83   -
84 86 }
85 87  
86 88 - (void)btnDidClicked{
... ...