react-native-video(Cannot remove an observer for the key path "readyForDis...

描述:

切换播放源的时候报错:Exception thrown while executing UI block: Cannot remove an observer for the key path "readyForDisplay" from because it is not registered as an observer
解决:
在该框架的作者下面发现的
链接是这个:https://github.com/react-native-community/react-native-video/issues/907,有兴趣的可以去看看。
解决办法如下:
在xcode中找到RCTVideo.m文件,然后找到方法removePlayerLayer,将方法的实现修改为:

[_playerLayer removeFromSuperlayer];
    @try {
        [_playerLayer removeObserver:self forKeyPath:readyForDisplayKeyPath];
    } @catch (NSException *e) { }
      _playerLayer = nil;

用xcode重新编译运行即可解决。

你可能感兴趣的:(react-native-video(Cannot remove an observer for the key path "readyForDis...)