AITranscriberManager
Copyright (c) 2026 Tencent. All rights reserved.
Module: AITranscriberManager @ TXLiteAVSDK
Function: APIs for AI real-time transcription and translation
Version: 13.5
AI real-time transcription and translation management APIs. Flutter SDK:
tencent_rtc_sdk. Obtain the instance via TRTCCloud's getAITranscriberManager and then call the APIs.Note:
1. Before using AI transcription, enable the AI recognition features (speech-to-text and real-time translation) in Console > Feature Configuration > Value-added Features.
2. For details, see related documentation.
Function List
Transcription Tasks
API | Description |
Starts real-time transcription. | |
Stops real-time transcription. |
Transcription Message Receiving Control
API | Description |
Pauses receiving transcription messages. | |
Resumes receiving transcription messages. |
Event Callbacks
API | Description |
Adds a transcription event listener. | |
Removes a transcription event listener. |
API Details
The following describes the signature, function, parameters, return value and notes of each API, in the order of the function list.
startRealtimeTranscriber
void startRealtimeTranscriber(TranscriberParams params)
Starts real-time transcription.
After this API is called, the SDK starts a transcription robot that recognizes the speech of specified users in the room as text and translates it into target languages as needed.
After a successful start, you will receive the onRealtimeTranscriberStarted callback in AITranscriberListener.
Transcription results are continuously delivered through the onReceiveTranscriberMessage callback.
If the start fails, you will receive the onRealtimeTranscriberError callback.
Parameter | Type | Description |
params |
Description:
It is recommended to register a listener via addListener before calling this API; otherwise, events during the startup phase may be missed.
Sample Code
transcriberManager.addListener(AITranscriberListener(onRealtimeTranscriberStarted: (String roomId, String transcriberRobotId) {debugPrint('Transcription started: $roomId / $transcriberRobotId');},onReceiveTranscriberMessage: (String roomId, TranscriberMessage message) {debugPrint('${message.speakerUserId}: ${message.sourceText}');},));transcriberManager.startRealtimeTranscriber(TranscriberParams(sourceLanguage: 'zh',translationLanguages: ['en', 'ja'],));
stopRealtimeTranscriber
void stopRealtimeTranscriber(String transcriberRobotId)
Stops real-time transcription.
After stopping, you will receive the onRealtimeTranscriberStopped callback in AITranscriberListener.
Parameter | Type | Description |
transcriberRobotId | String | Unique ID of the transcription robot, which can be obtained from the onRealtimeTranscriberStarted callback. |
pauseReceivingMessage
void pauseReceivingMessage()
Pauses receiving transcription messages.
resumeReceivingMessage
void resumeReceivingMessage()
Resumes receiving transcription messages.
addListener
void addListener(AITranscriberListener listener)
Adds a transcription event listener.
Through AITranscriberListener, you can receive event notifications such as transcription start, messages, stop and errors.
Parameter | Type | Description |
listener |
Description:
The SDK supports registering multiple listener objects at the same time, and events are dispatched to all registered objects. Registering the same object repeatedly takes effect only once.
removeListener
void removeListener(AITranscriberListener listener)
Removes a transcription event listener.
Parameter | Type | Description |
listener | The transcription event listener object to remove (must be the same object passed in during registration). |
Type Definitions
TranscriberParams
Real-time transcription parameters.
Field | Type | Default Value | Description |
transcriberRobotId | String? | null | Unique ID of the transcription robot. If not specified, the SDK generates a default ID: transcriber_${roomid}_robot_${userid}. |
sourceLanguage | String? | null | Source language code, for example, zh for Chinese and en for English. |
userIdsToTranscribe | List<String>? | null | List of user IDs to transcribe. If empty, all users in the room are transcribed. |
translationLanguages | List<String>? | null | List of target language codes for translation. Supported: zh, en, vi, ja, ko, id, th, pt, ar, es, fr, ms, de, it, ru. |
TranscriberMessage
Transcription message structure.
Field | Type | Default Value | Description |
segmentId | String | Required | Unique ID of the message segment. |
speakerUserId | String | Required | User ID of the speaker. |
sourceText | String | Required | Recognized source language text (Unicode encoded). |
translationTexts | Map<String, String> | Required | Translated texts, mapped by language code. |
timestamp | int | Required | UTC timestamp in milliseconds. |
isCompleted | bool | Required | Whether the transcription is completed. true: Recognition of the whole sentence is completed.false: Intermediate result. |
TranscriberStopReason
Reason why transcription stopped.
Enum Value | Value | Description |
userStopped | 0 | The user actively stopped the transcription. |
roomDismissed | 1 | The room was dismissed by the backend. |
allUsersLeft | 2 | All users have left the room for more than 30 seconds. |
AITranscriberListener
Event callbacks for AI real-time transcription.
Register via addListener and remove via removeListener. All callbacks are optional named parameters; just pass in the callbacks you care about.
onRealtimeTranscriberStarted
final void Function(String roomId, String transcriberRobotId)? onRealtimeTranscriberStarted
Transcription started successfully.
Parameter | Type | Description |
roomId | String | ID of the room where transcription is started. |
transcriberRobotId | String | Unique ID of the transcription robot. |
onReceiveTranscriberMessage
final void Function(String roomId, TranscriberMessage message)? onReceiveTranscriberMessage
Transcription message received.
Parameter | Type | Description |
roomId | String | ID of the room where the message comes from. |
message | Transcription message containing the recognized text and translated texts. For details, see TranscriberMessage. |
onRealtimeTranscriberStopped
final void Function(String roomId, String transcriberRobotId, TranscriberStopReason reason)? onRealtimeTranscriberStopped
Transcription stopped.
Parameter | Type | Description |
roomId | String | ID of the room where transcription is stopped. |
transcriberRobotId | String | Unique ID of the transcription robot. |
reason |
onRealtimeTranscriberError
final void Function(String roomId, String transcriberRobotId, int error, String errorInfo)? onRealtimeTranscriberError
Transcription error occurred.
Parameter | Type | Description |
roomId | String | ID of the room where the error occurred. |
transcriberRobotId | String | Unique ID of the transcription robot. |
error | int | Error code. |
errorInfo | String | Error message. |
