---
title: "startRecording(withMicrophoneEnabled:handler:)"
framework: replaykit
role: symbol
role_heading: Instance Method
path: "replaykit/rpscreenrecorder/startrecording(withmicrophoneenabled:handler:)"
---

# startRecording(withMicrophoneEnabled:handler:)

Starts recording the app’s audio and video.

## Declaration

```swift
func startRecording(withMicrophoneEnabled microphoneEnabled: Bool, handler: (((any Error)?) -> Void)? = nil)
```

## Parameters

- `microphoneEnabled`: Set to doc://com.apple.documentation/documentation/Swift/true to activate the microphone during the recording. Defaults to doc://com.apple.documentation/documentation/Swift/false.
- `handler`: A block that is called when the request completes.

## Discussion

Discussion Call startRecording(withMicrophoneEnabled:handler:) on an instance of the recorder to begin recording. When startRecording(withMicrophoneEnabled:handler:) is first called, an alert window appears asking the user to confirm recording. This alert window is also presented if it has been longer than 8 minutes since the last time startRecording(withMicrophoneEnabled:handler:) was called.

## See Also

### Controlling App Recording

- [startRecording(handler:)](replaykit/rpscreenrecorder/startrecording(handler:).md)
- [stopRecording(handler:)](replaykit/rpscreenrecorder/stoprecording(handler:).md)
- [stopRecording(withOutput:completionHandler:)](replaykit/rpscreenrecorder/stoprecording(withoutput:completionhandler:).md)
- [startCapture(handler:completionHandler:)](replaykit/rpscreenrecorder/startcapture(handler:completionhandler:).md)
- [RPSampleBufferType](replaykit/rpsamplebuffertype.md)
- [stopCapture(handler:)](replaykit/rpscreenrecorder/stopcapture(handler:).md)
- [discardRecording(handler:)](replaykit/rpscreenrecorder/discardrecording(handler:).md)
