Hello,
You can set the WKUIDelegate
for the webview in iOS.
public class CustomWebViewDelegate :WKUIDelegate
{
[Export("webView:requestMediaCapturePermissionForOrigin:initiatedByFrame:type:decisionHandler:")]
public override void RequestMediaCapturePermission(WKWebView webView, WKSecurityOrigin origin, WKFrameInfo frame, WKMediaCaptureType type,Action<WKPermissionDecision> decisionHandler)
{
decisionHandler(WKPermissionDecision.Grant);//As you (Anila Mathew) said, missing this line will result in a blank camera screen
base.RequestMediaCapturePermission(webView, origin, frame, type, decisionHandler);
}
}
Set the delegate in OnElementChanged
method in your WKWebviewRenderer
if (e.NewElement != null)
{
UIDelegate = new CustomWebViewDelegate();
}
Please watch the clip around 12:30 in this Apple's video- Explore WKWebView additions - WWDC21 - Videos - Apple Developer
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentationto enable e-mail notifications if you want to receive the related email notification for this thread.