Using RPScreenRecorder to record screen and microphone on swift 3

1.2k views Asked by At

It seems the startRecordWithMicrophone method has been deprecated, but they have implemented a startCapture method that is in beta, am I able to use this beta function? It doesnt come up in my options when using the recorder. I am forced to use the startRecording method which doesn't record the microphone, I have found very limited info on this please help. let recorder = RPScreenRecorder.shared() recorder.startRecording(handler: { (error) in

            if let error = error {
                print(error)
            }
        })

Apple Docs on RPSCreenRecorder.shared() enter image description here

1

There are 1 answers

0
Murat Ergun On

You may use startRecording method after setting isMicrophoneEnabled property.

let recorder = RPScreenRecorder.shared()
if recorder.isAvailable {
    recorder.isMicrophoneEnabled = true
    recorder.startRecording() { error in
        if let error = error {
            print(error)
        } else {
            // Recording
        }
    }
} else {
    // Show alert for screen recording being unavailable
}