lawndogg
lawndogg

Reputation: 127

Using RPScreenRecorder to record screen and microphone on swift 3

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

Upvotes: 0

Views: 1294

Answers (1)

Murat Ergun
Murat Ergun

Reputation: 26

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
}

Upvotes: 1

Related Questions