tencent_rtc_sdk. Obtain the instance via TRTCCloud's getAITranscriberManager and then call the APIs.API | Description |
Starts real-time transcription. | |
Stops real-time transcription. |
API | Description |
Pauses receiving transcription messages. | |
Resumes receiving transcription messages. |
API | Description |
Adds a transcription event listener. | |
Removes a transcription event listener. |
void startRealtimeTranscriber(TranscriberParams params)
Parameter | Type | Description |
params |
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'],));
void stopRealtimeTranscriber(String transcriberRobotId)
Parameter | Type | Description |
transcriberRobotId | String | Unique ID of the transcription robot, which can be obtained from the onRealtimeTranscriberStarted callback. |
void pauseReceivingMessage()
void resumeReceivingMessage()
void addListener(AITranscriberListener listener)
Parameter | Type | Description |
listener |
void removeListener(AITranscriberListener listener)
Parameter | Type | Description |
listener | The transcription event listener object to remove (must be the same object passed in during registration). |
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. |
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. |
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. |
final void Function(String roomId, String transcriberRobotId)? onRealtimeTranscriberStarted
Parameter | Type | Description |
roomId | String | ID of the room where transcription is started. |
transcriberRobotId | String | Unique ID of the transcription robot. |
final void Function(String roomId, TranscriberMessage message)? onReceiveTranscriberMessage
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. |
final void Function(String roomId, String transcriberRobotId, TranscriberStopReason reason)? onRealtimeTranscriberStopped
Parameter | Type | Description |
roomId | String | ID of the room where transcription is stopped. |
transcriberRobotId | String | Unique ID of the transcription robot. |
reason |
final void Function(String roomId, String transcriberRobotId, int error, String errorInfo)? onRealtimeTranscriberError
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. |
フィードバック