-
Notifications
You must be signed in to change notification settings - Fork 311
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
[iOS 15] Add support for new delegate WKUIDelegate decideMediaCapturePermissionFor #1671
Comments
Looks like this is declared as being supported back to iOS 14.5, but requires Xcode 13 to use it. |
These delegate methods are all over the place - some are |
I tried to implement it. Now the prompts are gone, but I don't get the orange recording indicator of iOS and I don't hear anything:/ |
What exactly have you tested where you do not hear anything? |
It looks like the only API they added for this in the iOS 15 release is: - (void)webView:(WKWebView *)webView
requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin
initiatedByFrame:(WKFrameInfo *)frame
type:(WKMediaCaptureType)type
decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler; which is documented (only in the headers, not in the actual docs, sigh) as:
This may behave as you'd like without any app-level changes. |
Oh I see, you'd like the app to always say yes so it doesn't always prompt. That also seems doable, assuming it is prompting correctly. |
Fixes #1671. ## Summary Always allows access to to the camera and microphone via `navigator.mediaDevices.getUserMedia`. ## Any other notes Since this is gated on the app-level system permission for Camera and Microphone, it feels silly to require the user to allow access to them during the normal app runtime - this is exclusively a weird WebView behavior-ism. Also doesn't feel worth making this a preference - if users don't want the frontend to access it, it seems to me like the app-level permission is enough. Tested this by using e.g. [the WebRTC samples](https://webrtc.github.io/samples/): going to a video or audio or both test page, after granting app permission, successfully starts right away.
Feature request / problem description
Every call to
getUserMedia()
from within a WKWebView instance will lead to a new permission popup requiring the user to allow/deny access to the camera and/or microphone. This is quite annoying from a user perspective.Example use-case: I use an audio/video capable Home Assistant card to have an audio/video connection to my doorbell within HA lovelace UI.
Describe the solution you'd like
Implement the new delegate
WKUIDelegate decideMediaCapturePermissionFor
to handlegetUserMedia()
media capture permission requests so that the user does not get a permission prompt for camera/microphone with every call togetUserMedia()
when loading or reloading a webpage from within an existing instance of WKWebView.Additional context
getUserMedia()
: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMediaThe text was updated successfully, but these errors were encountered: