Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug:网络预览图片和视频时闪退 —— 2.6.6 fixed #216

Closed
zhangzhanzg opened this issue Mar 20, 2018 · 7 comments
Closed

bug:网络预览图片和视频时闪退 —— 2.6.6 fixed #216

zhangzhanzg opened this issue Mar 20, 2018 · 7 comments

Comments

@zhangzhanzg
Copy link

2018-03-20 3 30 35

@longitachi
Copy link
Owner

具体是怎么操作,然后崩溃了?

@zhangzhanzg
Copy link
Author

就是进入网络预览页面,左右来回滑动切换图片和视频的崩溃了。猜测是因为KVO没有及时移除引起的

@ParadiseGitHub
Copy link

我遇到了同样的问题,在iPhone6 Plus iOS10系统,每次预览网络视频和图片时,都会崩溃,崩溃日志跟@zhangzhang 的一样,但是在iOS11就没有这个问题!!!

@longitachi
Copy link
Owner

@ParadiseGitHub 你试试在ZLPreviewNetVideo这个类的seekToZero添加如下代码

- (void)seekToZero
{
    [self.playLayer.player.currentItem removeObserver:self forKeyPath:@"playbackBufferEmpty"];
    [self.playLayer.player.currentItem removeObserver:self forKeyPath:@"playbackLikelyToKeepUp"];
    
    AVPlayer *player = self.playLayer.player;
    [player.currentItem seekToTime:kCMTimeZero];
}

@zhangzhanzg
Copy link
Author

zhangzhanzg commented Apr 19, 2018 via email

@ParadiseGitHub
Copy link

你好,添加这两行代码之后,没有解决问题,之前iOS11不会崩溃,iOS10会崩溃,崩溃之日是之前的记录。现在加上这两行代码iOS10、iOS11都会崩溃,崩溃日至如下:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <ZLPreviewNetVideo 0x117d68ae0> for the key path "playbackBufferEmpty" from <AVPlayerItem 0x1740198e0> because it is not registered as an observer.'

@longitachi
Copy link
Owner

2.6.6版本已经解决了,添加这两行代码,需要把之前dealloc中的observer删掉

@longitachi longitachi changed the title bug:网络预览图片和视频时闪退 bug:网络预览图片和视频时闪退 —— 2.6.6 fixed Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants