Skip to main content
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:
val callSession = CallSession.getInstance()
callSession.startRecording()
All participants are notified when recording starts.

Stop Recording

Stop an active recording:
val callSession = CallSession.getInstance()
callSession.stopRecording()

Auto-Start Recording

Configure calls to automatically start recording when the session begins:
val sessionSettings = CometChatCalls.SessionSettingsBuilder()
    .enableAutoStartRecording(true)
    .build()

Hide Recording Button

Hide the recording button from the default call UI:
val sessionSettings = CometChatCalls.SessionSettingsBuilder()
    .hideRecordingButton(true)
    .build()

Listen for Recording Events

Monitor recording state changes using MediaEventsListener:
val callSession = CallSession.getInstance()

callSession.addMediaEventsListener(this, object : MediaEventsListener() {
    override fun onRecordingStarted() {
        Log.d(TAG, "Recording started")
        showRecordingIndicator()
    }

    override fun onRecordingStopped() {
        Log.d(TAG, "Recording stopped")
        hideRecordingIndicator()
    }

    // Other callbacks...
    override fun onAudioMuted() {}
    override fun onAudioUnMuted() {}
    override fun onVideoPaused() {}
    override fun onVideoResumed() {}
    override fun onScreenShareStarted() {}
    override fun onScreenShareStopped() {}
    override fun onAudioModeChanged(audioMode: AudioMode) {}
    override fun onCameraFacingChanged(facing: CameraFacing) {}
})

Track Participant Recording

Monitor when other participants start or stop recording using ParticipantEventListener:
callSession.addParticipantEventListener(this, object : ParticipantEventListener() {
    override fun onParticipantStartedRecording(participant: Participant) {
        Log.d(TAG, "${participant.name} started recording")
    }

    override fun onParticipantStoppedRecording(participant: Participant) {
        Log.d(TAG, "${participant.name} stopped recording")
    }

    // Other callbacks...
})

Access Recordings

Recordings are available after the call ends. You can access them in two ways:
  1. CometChat Dashboard: Navigate to Calls > Call Logs in your CometChat Dashboard to view and download recordings.
  2. Programmatically: Fetch recordings through Call Logs:
val callLogRequest = CallLogRequest.CallLogRequestBuilder()
    .setHasRecording(true)
    .build()

callLogRequest.fetchNext(object : CometChatCalls.CallbackListener<List<CallLog>>() {
    override fun onSuccess(callLogs: List<CallLog>) {
        for (callLog in callLogs) {
            callLog.recordings?.forEach { recording ->
                Log.d(TAG, "Recording URL: ${recording.recordingURL}")
                Log.d(TAG, "Duration: ${recording.duration} seconds")
                Log.d(TAG, "Start Time: ${recording.startTime}")
                Log.d(TAG, "End Time: ${recording.endTime}")
            }
        }
    }

    override fun onError(e: CometChatException) {
        Log.e(TAG, "Error: ${e.message}")
    }
})

Recording Object

PropertyTypeDescription
ridStringUnique recording identifier
recordingURLStringURL to download/stream the recording
startTimeintTimestamp when recording started
endTimeintTimestamp when recording ended
durationdoubleRecording duration in seconds