1
我想在视频播放器上制作模糊效果。 因此,我使用AVPlayer播放视频,并且每当我想要将视频分享给社交,共享视频播放器上的窗口显示时。只是我想要应用模糊效果来共享窗口的背景。iOS 7对videoPlayer的模糊效果
renderContext函数不渲染AVPlayer的图层。但是我看到苹果的新API drawViewHierarchyInRect将渲染特定的图层,如视频播放器或OpenGL图层。
因此,我使用drawViewHierarchyInRect,它在模拟器上也能正常工作,但不能在设备上工作。
有什么想法?
- (UIImage *)snapshotOfVideoPlayer
{
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 1.0);
[self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:NO];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
是哪个设备?模糊效果/动画是否停止(效率)? – Larme
你能显示你的代码吗? – Raptor
感谢您的快速回复。设备是具有iOS 7的iPad4,它根本不起作用。总是黑色的图像。 – liwen