WKWebView doesn't take snapshot of WebGL

Hi, i’m using WKWebView (on IOS), which shows WebGL content, and try to save screenshot from it. But after capturing, the snapshot has not a 3D content.

For capturing i used classic method:


UIGraphicsBeginImageContextWithOptions(_webView.bounds.size, YES, 0);
[_webView drawViewHierarchyInRect:_webView.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();


In IOS 11 beta, WKWebView has a new API -


- (void)takeSnapshotWithConfiguration:(nullable WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(UIImage * _Nullable snapshotImage, NSError * _Nullable error))completionHandler API_AVAILABLE(ios(11.0));


but it returns the same result.


If I understand correctly, WKWebView uses separated some WK processes for rendering and CARender Server for collecting all render datas and pushes its to OpenGL/Metal pipeline. According to this scheme, I got the expected result. But all the same, how do i get snapshot ?


There is a possibility -takeSnapshotWithConfiguration: … will return image with full data in Release IOS11 , or in the next releases ?

Thanks.

We have the same problem and currently we didnt find a way how to do this. The only recommendation was to create image from the video frame, put it on the same place and from that taking a screenshot

WKWebView doesn't take snapshot of WebGL
 
 
Q