1

我刚刚为屏幕视频捕获创建了代码。它使用 UIView 可以完美运行。但是如果我使用 UIWebview,那么捕获屏幕视频会卡住。我知道原因。原因是在使用 Web 视图时

[[self.layer presentationLayer] renderInContext:mycontext];

不工作..我的应用程序崩溃了

所以,如果表示层不工作,视频就会卡住。并使用这条线

[self.layer renderInContext:mycontext];

屏幕捕获正在工作,但视频显示卡住。

这是代码,当用户在他或她的手机上浏览任何网站时。

UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, 0.0);

CGContextRef mycontext = UIGraphicsGetCurrentContext();

if([[self.layer presentationLayer] respondsToSelector:@selector(renderInContext:)])
{
    [[self.layer presentationLayer] renderInContext:mycontext];
}
else
{
    [self.layer renderInContext:mycontext];
}


UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

在滚动 webview 并捕获视频时,比捕获屏幕视频显示卡住..

有什么解决办法吗?

4

0 回答 0