Available since v5.0.4 — transcription and closed captions require CometChat Calls SDK v5.0.4 or later for Android. See Setup to install or upgrade.
TranscriptRequest.
How It Works
Transcription and closed captions are two related but separate things:
Starting transcription is a prerequisite for captions — toggling captions on without an active transcription shows nothing.
Starting Transcription
Auto-Start Transcription
Configure transcription to start automatically when the session begins:- Kotlin
- Java
false
Manual Transcription Control
Transcription can be started and stopped during an active call through theCallSession singleton.
Start Transcription
- Kotlin
- Java
Stop Transcription
Stops the current transcription. Any captions currently on screen are cleared:- Kotlin
- Java
Always check
isSessionActive() before calling these actions to ensure there’s an active call.Built-in UI Controls
On Android, both transcription controls live in the control panel’s More menu and are hidden by default.Transcription Button
To show the Start Transcription / Stop Transcription item:- Kotlin
- Java
true
The menu item toggles between Start Transcription and Stop Transcription based on the current state.
Closed Caption Button
To show the Show Captions / Hide Captions item, which toggles the on-screen captions overlay:- Kotlin
- Java
true
Even with
hideClosedCaptionButton(false), the captions item only appears once transcription is running for the session, because captions are generated from the live transcript.Caption Language
Method:setCaptionLanguage(String)
Sets the language used for transcription and captions. This is fixed for the session — there is no in-call language picker on Android.
- Kotlin
- Java
en-US
Supported Language Codes
Supported Language Codes
Retrieving Transcripts
After a call, useTranscriptRequest to list the transcript artifacts for a session. Each record is a pointer to a downloadable transcript file, not the transcript text itself.
The SDK must be initialized with
CometChatCalls.init() and a user must be logged in. The auth token is read from the logged-in user at fetch time, so it automatically tracks re-logins.Building a Request
- Kotlin
- Java
Paginating
ATranscriptRequest is a stateful cursor. Create one per session ID and drive it with fetchNext() and fetchPrevious():
- Kotlin
- Java
fetchNext()delivers the next page, or an empty list when there are no more pages. A session with no transcripts delivers an empty list.fetchPrevious()delivers the previous page, or an empty list when already on the first page. It never requests a page below1.- Only one fetch may be in flight at a time. Calling
fetchNext()orfetchPrevious()while another request is pending reportsERROR_REQUEST_IN_PROGRESS; the original call is unaffected and still completes. - Callbacks are always delivered on the main thread.
Transcript Object
Every property is optional. The server omits keys whose value is empty, so String getters may return
null and numeric getters 0. Sparse records are normal and should not be treated as an error.Reading the Transcript Content
transcriptUrl points at the transcript file. Download it with your HTTP client of choice to read the actual utterances:
- Kotlin
- Java
Error Handling
All errors — including pre-flight validation — are delivered toonError() with a CometChatException carrying a code. build() never throws.
Complete Example
- Kotlin
- Java