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

# setCameraCaptureState(_:completionHandler:)

Changes whether the webpage is using the camera to capture images or video.

## Declaration

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

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

## Parameters

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

## See Also

### Managing the microphone and camera

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