AI Real-Time Subtitles
Feature Introduction
After integrating TUIRoomKit, you can enable the AI real-time subtitle feature by clicking "AI Assistant" in the bottom bar. The feature is achievable:
AI real-time subtitles: Display the discussion content during the meeting process in the form of subtitles.
AI real-time meeting minutes: Record the discussion content during the meeting process in text form.
Note:
Using this feature requires subscribing to TUIRoomKit Activate the Service. Except for normal call charges (Audio/Video Duration Billing Instructions); when this feature performs speech to text, additional AI Intelligent Identification fees will occur. For details, see AI Intelligent Identification Billing Instructions.
Click AI assistant in the bottom bar. | Enable AI real-time subtitles | View AI Real-Time Meeting Minutes |
![]() | ![]() | ![]() |
Feature Integration
Prerequisites for Access
Turn on the "AI assistant" button in the bottom bar.
ConferenceSessionImpl.sharedInstance().isShowAISpeechToTextButton = true;
Enable AI Real-Time Subtitles
Enable the AI real-time subtitle feature, which actually starts an AI transcription task. During this process, the backend will use robot stream pulling to perform real-time speech recognition and send subtitles and transcription messages. For more information on parameter configuration for enabling AI transcription tasks and querying transcription task status, please refer to AI service-related interfaces.
After a room is created, you can enable the AI real-time subtitle feature by using the following example code.
Note:
The voice transcription feature requires a key to be enabled. Since code leakage may lead to the leakage of SecretId and SecretKey, and threaten the security of all resources under the account. It is recommended to use the key in a more secure way. For details, see Recommended Cloud API Key Security Solutions. The key can be obtained by going to API Key Management.
private String mTaskId; // Task ID after enabling AI transcriptionprivate String aiSecretId = "PLACEHOLDER"; // AI voice transcription IDprivate String aiSecretKey = "PLACEHOLDER"; // AI voice transcription keyprivate String roomId = "PLACEHOLDER"; // Room IDprivate int sdkAppId = 0L; // Your SDKAppIdprivate String sdkSecretKey = "PLACEHOLDER"; // Your SDKAppId keyprivate String robotUserId = "PLACEHOLDER"; // AI chatbot's userId in the room, which cannot be the same as other users' userIds in the roomprivate void startAITranscription() {Runnable startAITranscriptionRun = () -> {try {// Code leakage may lead to the leakage of aiSecretId and aiSecretKey, and threaten the security of all resources under the account.// The following code example is for reference only. It is recommended to use the key in a more secure way. Please see: https://cloud.tencent.com/document/product/1278/85305// Obtain the key at the official website console https://console.cloud.tencent.com/cam/capiCredential credential = new Credential(aiSecretId, aiSecretKey);TrtcClient client = new TrtcClient(credential, null);StartAITranscriptionRequest request = new StartAITranscriptionRequest();request.setRoomId(roomId);request.setRoomIdType(1L);request.setSdkAppId((long)sdkAppId);TranscriptionParams transcriptionParams = new TranscriptionParams();transcriptionParams.setUserId(robotUserId);transcriptionParams.setUserSig(GenerateTestUserSig.genTestUserSig(sdkAppId, robotUserId, sdkSecretKey));request.setTranscriptionParams(transcriptionParams);StartAITranscriptionResponse response = client.StartAITranscription(request);mTaskId = response.getTaskId();} catch (TencentCloudSDKException e) {e.printStackTrace();}};new Thread(startAITranscriptionRun).start();}
private var mTaskId: String? = null // Task ID after enabling AI transcriptionprivate val aiSecretId = "PLACEHOLDER" // AI voice transcription IDprivate val aiSecretKey = "PLACEHOLDER" // AI voice transcription keyprivate val roomId = "PLACEHOLDER" // Room IDprivate val sdkAppId = 0L // Your SDKAppIdprivate val sdkSecretKey = "PLACEHOLDER" // Your SDKAppId keyprivate val robotUserId = "PLACEHOLDER" // AI chatbot's userId in the room, which cannot be the same as other users' userIds in the roomprivate fun startAITranscription() {Thread {try {// Code leakage may lead to the leakage of aiSecretId and aiSecretKey, and threaten the security of all resources under the account.// The following code example is for reference only. It is recommended to use the key in a more secure way. Please see: https://cloud.tencent.com/document/product/1278/85305// Obtain the key at the official website console https://console.cloud.tencent.com/cam/capival credential = Credential(aiSecretId, aiSecretKey)val client = TrtcClient(credential, null)val request = StartAITranscriptionRequest()request.roomId = roomIdrequest.roomIdType = 1Lrequest.sdkAppId = sdkAppIdval transcriptionParams = TranscriptionParams()transcriptionParams.userId = robotUserIdtranscriptionParams.userSig = GenerateTestUserSig.genTestUserSig(sdkAppId, robotUserId, sdkSecretKey)request.transcriptionParams = transcriptionParamsval response = client.StartAITranscription(request)mTaskId = response?.taskId} catch (e: TencentCloudSDKException) {e.printStackTrace()}}.start()}
Disable AI Real-Time Subtitles Feature
You can call the following code to disable the AI real-time subtitle feature when exiting room / terminating room.
private void stopAITranscription() {Runnable stopAITranscriptionRun = () -> {try {Credential credential = new Credential(secretId, secretKey);TrtcClient client = new TrtcClient(credential, null);StopAITranscriptionRequest stopAITranscriptionRequest = new StopAITranscriptionRequest();stopAITranscriptionRequest.setTaskId(mTaskId);client.StopAITranscription(stopAITranscriptionRequest);} catch (TencentCloudSDKException e) {e.printStackTrace();}};new Thread(stopAITranscriptionRun).start();}
private fun stopAITranscription() {Thread {try {val credential = Credential(secretId, secretKey)val client = TrtcClient(credential, null)val stopAITranscriptionRequest = StopAITranscriptionRequest()stopAITranscriptionRequest.taskId = mTaskIdclient.StopAITranscription(stopAITranscriptionRequest)} catch (e: TencentCloudSDKException) {e.printStackTrace()}}.start()}
Note:
If you have any requirements or feedback during the integration and use process, you can contact: info_rtc@tencent.com.