Commit 486f304e372a6ac36d18a9cab354091a22e2eb7b

Authored by zhangxiaowen
1 parent 7ba010cb

no message

CNLivePlayer/Classes/Player/CNLivePlayer.m
@@ -196,7 +196,10 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang @@ -196,7 +196,10 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
196 __weak typeof(self) weakSelf = self; 196 __weak typeof(self) weakSelf = self;
197 dispatch_async(dispatch_get_global_queue(0, 0), ^{ 197 dispatch_async(dispatch_get_global_queue(0, 0), ^{
198 __strong typeof(self) strongSelf = weakSelf; 198 __strong typeof(self) strongSelf = weakSelf;
199 - [strongSelf getUrlSuccess:authSuccessBlock failure:authFailureBlock]; 199 + if(strongSelf){
  200 + [strongSelf getUrlSuccess:authSuccessBlock failure:authFailureBlock];
  201 +
  202 + }
200 203
201 }); 204 });
202 205
@@ -248,7 +251,10 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang @@ -248,7 +251,10 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
248 __weak typeof(self) weakSelf = self; 251 __weak typeof(self) weakSelf = self;
249 dispatch_async(dispatch_get_global_queue(0, 0), ^{ 252 dispatch_async(dispatch_get_global_queue(0, 0), ^{
250 __strong typeof(self) strongSelf = weakSelf; 253 __strong typeof(self) strongSelf = weakSelf;
251 - [strongSelf getUrlSuccess:authSuccessBlock failure:authFailureBlock]; 254 + if(strongSelf){
  255 + [strongSelf getUrlSuccess:authSuccessBlock failure:authFailureBlock];
  256 +
  257 + }
252 258
253 }); 259 });
254 260
@@ -671,10 +677,11 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang @@ -671,10 +677,11 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
671 [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil]; 677 [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
672 678
673 [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification object:nil]; 679 [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification object:nil];
674 -  
675 - [[NSNotificationCenter defaultCenter] removeObserver:self name:CacheStatusNotification object:nil];  
676 -  
677 - [[NSNotificationCenter defaultCenter] removeObserver:self name:CacheErrorNotification object:nil]; 680 + if(PLAYER_OpenCache){
  681 + [[NSNotificationCenter defaultCenter] removeObserver:self name:CacheStatusNotification object:nil];
  682 +
  683 + [[NSNotificationCenter defaultCenter] removeObserver:self name:CacheErrorNotification object:nil];
  684 + }
678 685
679 } 686 }
680 687
@@ -774,8 +781,11 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang @@ -774,8 +781,11 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang
774 __weak typeof(self) weakSelf = self; 781 __weak typeof(self) weakSelf = self;
775 dispatch_async(dispatch_get_main_queue(), ^{ 782 dispatch_async(dispatch_get_main_queue(), ^{
776 __strong typeof(self) strongSelf = weakSelf; 783 __strong typeof(self) strongSelf = weakSelf;
777 - NSString *key = [NSString stringWithFormat:@"%@:%@",strongSelf->_contentId, strongSelf->_rate];  
778 - [[CNLivePlayerDBTool shared] updateInTable:key]; 784 + if(strongSelf){
  785 + NSString *key = [NSString stringWithFormat:@"%@:%@",strongSelf->_contentId, strongSelf->_rate];
  786 + [[CNLivePlayerDBTool shared] updateInTable:key];
  787 + }
  788 +
779 }); 789 });
780 } 790 }
781 } 791 }