Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问 dsuiDelegate 与 requestMediaCapturePermissionFor 代理实现 #147

Open
liuyu8848 opened this issue Aug 12, 2022 · 2 comments
Open

Comments

@liuyu8848
Copy link

你好,我在设置 webView1.dsuiDelegate = self 之后

H5页面请求录音时 并没有触发 WKUIDelegate 的 func webView(_ webView: WKWebView, requestMediaCapturePermissionFor 方法

于是我将 webView1.uiDelegate = self 之后,requestMediaCapturePermissionFor可以触发,但是所有的桥接功能都失效了

谢谢

@QinYaffeei
Copy link

因为DWKWebView已经持有UIDelegate,但是作者暂时没有实现该代理方法,需要在DWKWebView.m中增加该代理的实现,如:
- (void)webView:(WKWebView *)webView requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin initiatedByFrame:(WKFrameInfo *)frame type:(WKMediaCaptureType)type decisionHandler:(void (^)(WKPermissionDecision))decisionHandler API_AVAILABLE(ios(15.0)){ if (self.DSUIDelegate && [self.DSUIDelegate respondsToSelector:@selector(webView:requestMediaCapturePermissionForOrigin:initiatedByFrame:type:decisionHandler:)]) { return [self.DSUIDelegate webView:webView requestMediaCapturePermissionForOrigin:origin initiatedByFrame:frame type:type decisionHandler:decisionHandler]; } decisionHandler(WKPermissionDecisionGrant); }

@aoxiaojun666
Copy link

iOS17 点允许后,前端提示 notAllowed。而直接实现WebView自己的uiDelegate却不会有该问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants