Record call sessions for later playback. Recordings are stored server-side and can be accessed through call logs or the CometChat Dashboard.
Recording must be enabled for your CometChat app. Contact support or check your Dashboard settings if recording is not available.
Start Recording
Start recording during an active call session:
CallSession.shared.startRecording()
[[CallSession shared] startRecording];
All participants are notified when recording starts.
Stop Recording
Stop an active recording:
CallSession.shared.stopRecording()
[[CallSession shared] stopRecording];
Auto-Start Recording
Configure calls to automatically start recording when the session begins:
let sessionSettings = CometChatCalls.sessionSettingsBuilder
.enableAutoStartRecording(true)
.build()
SessionSettings *sessionSettings = [[[CometChatCalls sessionSettingsBuilder]
enableAutoStartRecording:YES]
build];
Hide the recording button from the default call UI:
let sessionSettings = CometChatCalls.sessionSettingsBuilder
.hideRecordingButton(true)
.build()
SessionSettings *sessionSettings = [[[CometChatCalls sessionSettingsBuilder]
hideRecordingButton:YES]
build];
Listen for Recording Events
Monitor recording state changes using MediaEventsListener:
class CallViewController: UIViewController, MediaEventsListener {
override func viewDidLoad() {
super.viewDidLoad()
CallSession.shared.addMediaEventsListener(self)
}
deinit {
CallSession.shared.removeMediaEventsListener(self)
}
func onRecordingStarted() {
print("Recording started")
showRecordingIndicator()
}
func onRecordingStopped() {
print("Recording stopped")
hideRecordingIndicator()
}
// Other callbacks...
func onAudioMuted() {}
func onAudioUnMuted() {}
func onVideoPaused() {}
func onVideoResumed() {}
func onScreenShareStarted() {}
func onScreenShareStopped() {}
func onAudioModeChanged(audioModeType: AudioModeType) {}
func onCameraFacingChanged(cameraFacing: CameraFacing) {}
}
@interface CallViewController () <MediaEventsListener>
@end
@implementation CallViewController
- (void)viewDidLoad {
[super viewDidLoad];
[[CallSession shared] addMediaEventsListener:self];
}
- (void)dealloc {
[[CallSession shared] removeMediaEventsListener:self];
}
- (void)onRecordingStarted {
NSLog(@"Recording started");
[self showRecordingIndicator];
}
- (void)onRecordingStopped {
NSLog(@"Recording stopped");
[self hideRecordingIndicator];
}
// Other callbacks...
@end
Track Participant Recording
Monitor when other participants start or stop recording using ParticipantEventListener:
class CallViewController: UIViewController, ParticipantEventListener {
override func viewDidLoad() {
super.viewDidLoad()
CallSession.shared.addParticipantEventListener(self)
}
func onParticipantStartedRecording(participant: Participant) {
print("\(participant.name ?? "") started recording")
}
func onParticipantStoppedRecording(participant: Participant) {
print("\(participant.name ?? "") stopped recording")
}
// Other callbacks...
}
- (void)onParticipantStartedRecordingWithParticipant:(Participant *)participant {
NSLog(@"%@ started recording", participant.name);
}
- (void)onParticipantStoppedRecordingWithParticipant:(Participant *)participant {
NSLog(@"%@ stopped recording", participant.name);
}
Access Recordings
Recordings are available after the call ends. You can access them in two ways:
-
CometChat Dashboard: Navigate to Calls > Call Logs in your CometChat Dashboard to view and download recordings.
-
Programmatically: Fetch recordings through Call Logs.
Recording Object
| Property | Type | Description |
|---|
rid | String | Unique recording identifier |
recordingURL | String | URL to download/stream the recording |
startTime | Int | Timestamp when recording started |
endTime | Int | Timestamp when recording ended |
duration | Double | Recording duration in seconds |