Skip to main content
Quick Reference for AI Agents & Developers
  • Enable recording: CallSettingsBuilder().startRecordingOnCallStart(true).build()
  • Start recording: CallManager.startRecording()
  • Stop recording: CallManager.stopRecording()
  • Show button: CallSettingsBuilder().showCallRecordButton(true).build()
  • Related: Call Session · Ringing · Calling Overview
This section will guide you to implement call recording feature for the voice and video calls.

Implementation

Once you have decided to implement Default Calling or Direct Calling calling and followed the steps to implement them. Just few additional listeners and methods will help you quickly implement call recording in your app. You need to make changes in the CometChat.startCall method and add the required listeners for recording. Please make sure your callSettings is configured accordingly for Default Calling or Direct Calling. A basic example of how to make changes to implement recording for a direct/default call:
let sessionID = "12345" //you can set anything
let callView = UIView()// a UIView you want to show the calling view in
let callToken = ""

let callSettings = CallSettings.CallSettingsBuilder(callView: callView, sessionId:sessionID).setAudioOnlyCall(audioOnly: true).enableDefaultLayout(defaultLayout: true).build()

CometChatCalls.startSession(callToken: callToken, callSetting: callSettings, view: callView) { success in
    print("CometChatCalls startSession success: \(success)")
} onError: { error in
    print("CometChatCalls startSession error: \(String(describing: error?.errorDescription))")
}

Settings for call recording

The CallSettings class allows you to customise the overall calling experience. The properties for the call/conference can be set using the CallSettingsBuilder class. This will eventually give you an object of the CallSettings class which you can pass to the startCall() method to start the call. The options available for recording of calls are:
SettingTypeDefaultDescription
showCallRecordButton(_:)BoolfalseShow/hide recording button in UI
startRecordingOnCallStart(_:)BoolfalseAuto-start recording when call starts
CallSettingsBuilder Parameters:
PropertyTypeValue
callViewUIViewView to render call UI
sessionIdString”session_12345”
audioOnlyBoolfalse
defaultLayoutBooltrue
showCallRecordButtonBooltrue

Show Recording Button

let callSettings = CallSettings.CallSettingsBuilder(callView: callView, sessionId: sessionID)
    .setAudioOnlyCall(audioOnly: false)
    .enableDefaultLayout(defaultLayout: true)
    .showCallRecordButton(true)
    .build()

Auto-Start Recording

let callSettings = CallSettings.CallSettingsBuilder(callView: callView, sessionId: sessionID)
    .setAudioOnlyCall(audioOnly: false)
    .enableDefaultLayout(defaultLayout: true)
    .startRecordingOnCallStart(true)
    .build()

Start Recording

You can use the startRecording() method to start call recording manually during an active call.
CallManager.startRecording()

// Alternative using CometChatCalls directly:
CometChatCalls.startRecording()

Stop Recording

You can use the stopRecording() method to stop call recording.
CallManager.stopRecording()

// Alternative using CometChatCalls directly:
CometChatCalls.stopRecording()

Recording Listener

Implement CallsEventsDelegate to receive recording state change notifications. All participants receive the onRecordingToggled callback when recording starts or stops.
extension ViewController: CallsEventsDelegate {
    func onRecordingToggled(recordingInfo: RTCRecordingInfo) {
        print("Recording state changed: \(recordingInfo)")
        // Update UI based on recording state
    }
}
RTCRecordingInfo Object:
PropertyTypeDescription
isRecordingBool?Is recording currently active
startedByRTCUser?User who started recording
Triggered When:
ScenarioCallback Received
CallManager.startRecording() calledYes - all participants
CallManager.stopRecording() calledYes - all participants
Recording button pressed in UIYes - all participants
Auto-start recording on call startYes - all participants
Call ends while recordingRecording auto-stops