fix crash bug

This commit is contained in:
YasirYang 2018-02-05 21:04:07 +08:00
parent 723df5d4ae
commit 80b71b1922

View File

@ -732,7 +732,10 @@ static NSString *const timedMetadata = @"timedMetadata";
- (void)removePlayerLayer - (void)removePlayerLayer
{ {
[_playerLayer removeFromSuperlayer]; [_playerLayer removeFromSuperlayer];
[_playerLayer removeObserver:self forKeyPath:readyForDisplayKeyPath]; @try{
[_playerLayer removeObserver:self forKeyPath:readyForDisplayKeyPath];
}@catch (NSException * e) {
}
_playerLayer = nil; _playerLayer = nil;
} }
@ -823,7 +826,10 @@ static NSString *const timedMetadata = @"timedMetadata";
{ {
[_player pause]; [_player pause];
if (_playbackRateObserverRegistered) { if (_playbackRateObserverRegistered) {
[_player removeObserver:self forKeyPath:playbackRate context:nil]; @try{
[_player removeObserver:self forKeyPath:playbackRate context:nil];
}@catch (NSException * e) {
}
_playbackRateObserverRegistered = NO; _playbackRateObserverRegistered = NO;
} }
_player = nil; _player = nil;