From 80b71b19228c019a391f50035694f5222951d4a5 Mon Sep 17 00:00:00 2001 From: YasirYang Date: Mon, 5 Feb 2018 21:04:07 +0800 Subject: [PATCH] fix crash bug --- ios/RCTVideo.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ios/RCTVideo.m b/ios/RCTVideo.m index 0f1227b1..e4548e72 100644 --- a/ios/RCTVideo.m +++ b/ios/RCTVideo.m @@ -732,7 +732,10 @@ static NSString *const timedMetadata = @"timedMetadata"; - (void)removePlayerLayer { [_playerLayer removeFromSuperlayer]; - [_playerLayer removeObserver:self forKeyPath:readyForDisplayKeyPath]; + @try{ + [_playerLayer removeObserver:self forKeyPath:readyForDisplayKeyPath]; + }@catch (NSException * e) { + } _playerLayer = nil; } @@ -823,7 +826,10 @@ static NSString *const timedMetadata = @"timedMetadata"; { [_player pause]; if (_playbackRateObserverRegistered) { - [_player removeObserver:self forKeyPath:playbackRate context:nil]; + @try{ + [_player removeObserver:self forKeyPath:playbackRate context:nil]; + }@catch (NSException * e) { + } _playbackRateObserverRegistered = NO; } _player = nil;