Available since v5.0.7 — transcription and closed captions require CometChat Calls SDK v5.0.7 or later for Flutter. See Setup to install or upgrade.
TranscriptRequestBuilder.
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:false
Manual Transcription Control
Start Transcription
Begin transcribing during an active call:Stop Transcription
Stop the current transcription. Any captions currently on screen are cleared:Check Transcription State
CallSession exposes the local transcription state so you can drive a custom control:
CometChatCallsException if the underlying call fails — ERROR_START_TRANSCRIPTION and ERROR_STOP_TRANSCRIPTION respectively:
Built-in UI Controls
Transcription Button
The transcription start/stop item in the control panel’s More menu is hidden by default. To show it:true
The menu item toggles between Start Transcription and Stop Transcription based on the current state.
Closed Caption Button
The closed-caption (CC) button in the control panel is hidden by default. To show it:true
Even with
hideClosedCaptionButton(false), the CC button only appears once transcription is running for the session, because captions are generated from the live transcript.Closed Caption Settings
When the CC button is visible, the settings dialog gains a Closed Caption tab where the user can pick the caption language and enable or disable the on-screen captions. The gear icon on the captions overlay opens the dialog directly on that tab.Caption Language
Method:setCaptionLanguage(String)
Sets the language used for transcription and captions.
en-US
Supported Language Codes
Supported Language Codes
Retrieving Transcripts
After a call, useTranscriptRequestBuilder 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 — there is no auth token setter on the builder.Building a Request
Both builder methods have equivalent public fields, so
TranscriptRequestBuilder()..sessionId = "..." works too.Paginating
ATranscriptRequest is a stateful cursor. Create one per session ID and drive it with fetchNext() and fetchPrevious(). Both also return a Future that resolves with the same page handed to onSuccess, so you can await them instead of nesting callbacks:
fetchNext()delivers the next page, or an empty list once the last page has been reached. A session with no transcripts delivers an empty list on the first call.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_PROGRESStoonError; the original call is unaffected and still completes. - The returned
Futurenever completes with an error — failures always arrive throughonErrorand the future resolves with an empty list, so a caller that does notawaitcan never trip an unhandled async exception.
Transcript Properties
Every property is optional. The server omits keys whose value is empty, so sparse records are normal and should not be treated as an error. A malformed entry within a page is skipped rather than failing the whole page.
Reading the Transcript Content
transcriptUrl points at the transcript file. Fetch it yourself — with package:http or any client of your choice — to read the actual utterances:
Error Handling
Every failure — pre-flight validation and server errors alike — is delivered toonError as a CometChatCallsException carrying a code, message and details:
Transcripts in Call Logs
Call logs can be filtered to transcribed calls, which also attaches each call’s transcripts to the log:getTranscriptions() returns an empty list when the server omitted transcripts, so it never needs a null check. Leaving the filter off sends no filter at all, so the list comes back unfiltered exactly as if it had never been set.