---
title: "setMicrophoneCaptureState(_:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebview/setmicrophonecapturestate(_:completionhandler:)"
---

# setMicrophoneCaptureState(_:completionHandler:)

Changes whether the webpage is using the microphone to capture audio.

## Declaration

```swift
func setMicrophoneCaptureState(_ state: WKMediaCaptureState, completionHandler: (@MainActor @Sendable () -> Void)? = nil)
```

```swift
func setMicrophoneCaptureState(_ state: WKMediaCaptureState) async
```

## Parameters

- `state`: An enumeration case that indicates whether the webpage should use the microphone to capture audio.
- `completionHandler`: A closure the system executes after changing whether the webpage is using the microphone to capture audio.

## See Also

### Managing the microphone and camera

- [cameraCaptureState](webkit/wkwebview/cameracapturestate.md)
- [microphoneCaptureState](webkit/wkwebview/microphonecapturestate.md)
- [setCameraCaptureState(_:completionHandler:)](webkit/wkwebview/setcameracapturestate(_:completionhandler:).md)
- [WKMediaCaptureState](webkit/wkmediacapturestate.md)
