用WKWebView打开一个正在直播的链接,然后截取一阵有直播视频画面的截图

用WKWebView打开一个正在直播的链接后,怎样截取一阵有直播视频画面的截图?
就像这样用系统home键+锁屏键截取出的图片:
带有直播视频内容的截图

我使用一下代码进行截图

UIView *tempView =  [[UIView alloc] init];
_tempView = tempView;
tempView.frame = self.view.bounds;
[self.view  addSubview:tempView];


  WKWebView *webView = [[WKWebView alloc]initWithFrame:CGRectMake(0, kNavH, MScreenW,MScreenH - kNavH) configuration:configuration];
_webView = webView;
  [tempView addSubview:webView];
  
  
   UIGraphicsBeginImageContextWithOptions(tempView.bounds.size, NO, [UIScreen mainScreen].scale);
[self.view drawViewHierarchyInRect:tempView.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

没有直播视频的内容

阅读 3.7k
1 个回答
推荐问题