---
title: "webView(_:requestMediaCapturePermissionFor:initiatedByFrame:type:decisionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkuidelegate/webview(_:requestmediacapturepermissionfor:initiatedbyframe:type:decisionhandler:)"
---

# 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

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

```swift
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

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

## See Also

### Requesting permissions

- [webView(_:requestDeviceOrientationAndMotionPermissionFor:initiatedByFrame:decisionHandler:)](webkit/wkuidelegate/webview(_:requestdeviceorientationandmotionpermissionfor:initiatedbyframe:decisionhandler:).md)
- [WKPermissionDecision](webkit/wkpermissiondecision.md)
- [WKMediaCaptureType](webkit/wkmediacapturetype.md)
