Contents

webView(_:requestMediaCapturePermissionFor:initiatedByFrame:type:decisionHandler:)

Determines whether a web resource, which the security origin object describes, can access to the device’s microphone audio and camera video.

Declaration

optional func webView(_ webView: WKWebView, requestMediaCapturePermissionFor origin: WKSecurityOrigin, initiatedByFrame frame: WKFrameInfo, type: WKMediaCaptureType, decisionHandler: @escaping @MainActor @Sendable (WKPermissionDecision) -> Void)
optional func webView(_ webView: WKWebView, decideMediaCapturePermissionsFor origin: WKSecurityOrigin, initiatedBy frame: WKFrameInfo, type: WKMediaCaptureType) async -> WKPermissionDecision

Parameters

  • webView:

    The web view requesting permission for microphone audio and camera video.

  • origin:

    An object that identifies the host name, protocol, and port number for a web resource.

  • frame:

    The frame that initiates the request in the web view.

  • type:

    An enumeration case representing a type of media capture device, like a microphone or camera.

  • decisionHandler:

    A closure that you call from your delegate method. Pass the permission decision you determine to the closure.

Discussion

If you don’t implement this method in your delegate, the system returns WKPermissionDecision.prompt.

See Also

Requesting permissions