Visual Understanding
Feature Overview
TRTC AI Real-Time Conversation enables advanced voice assistant scenarios, such as "screen viewing during a call", by integrating Visual Language Model (VLM) capabilities into the audio dialogue pipeline. With VLM, the client captures camera frames on demand and uploads them to the AI backend, where each screenshot is paired with the user's voice query and sent to a multimodal large model. The large language model (LLM) then generates responses based on both the user's voice input and visual content.
Screenshot Conversation (Three-Stage) Architecture Diagram:
Functional Principle
The visual understanding pipeline is optimized for efficiency and does not analyze every frame in real time. Instead, it follows an intelligent approach of "on-demand capture and analysis":
Stage | Description |
Screenshot Strategy | Captures camera frames only when needed. |
Backend Cache + Storage | The TRTC backend temporarily stores the most recent frames in a sliding buffer. Optionally, screenshots can also be asynchronously uploaded to cloud storage for archiving. |
On-Demand LLM Submission | When triggered by user interaction (such as a voice query or periodic event), the backend retrieves relevant screenshots from the cache and submits them, along with user text or commands, to the multimodal LLM for analysis. |
VLM Response | The LLM analyzes both the voice query and screenshot content to generate a response, for example: "The button in your screenshot can't be clicked because it is currently disabled and greyed out." |
Supported interaction modes include: real-time screen queries (questions about the current screen), frame-specific queries (questions about a particular frame), and local album queries (questions about a local image).
Configuration Structure
To enable visual understanding when creating an AI conversation task, configure the
VisionConfig parameter as follows:"VisionConfig": {"Enable": true,"StorageType": 0,"CloudStorage": null}
VisionConfig Field Description:
Field Name | Required | Type | Description |
Enable | Yes | Boolean | Whether to enable VLM. Cannot be switched at runtime; the task must be recreated to change this option. |
StorageType | No | Integer | Storage type: 0 = No storage (default);1 = Use cloud storage (requires CloudStorage). Cannot be updated. |
CloudStorage | No | Object | Cloud storage archiving configuration. See the table below for details. |
CloudStorage Field Description:
Field Name | Required | Type | Description |
Vendor | Yes | Integer | 0 = Tencent Cloud COS;1 = AWS S3. |
Region | Yes | String | Storage region. |
Bucket | Yes | String | Bucket name. |
AccessKey | Yes | String | Access key (COS uses SecretId). |
SecretKey | Yes | String | Secret key (COS uses SecretKey). |
FileNamePrefix | No | Array of String | Array of storage path prefixes, with a total length ≤ 128. |
Activation Conditions
Condition | Description |
Multimodal Model | LLMConfig.Model must be a multimodal model, such as hunyuan-vision, gpt-4o, gpt-4o-mini, or qwen-vl-plus. |
Cascade Mode Only | Visual understanding is only supported in three-stage (cascade) mode. S2S + VLM is not supported. |
SDK Version | The client TRTC SDK must be upgraded to a version that supports screenshot functionality. |
No Hot Update Support | VisionConfig does not support runtime updates. Any changes require ending the task and creating a new one. |
Client Activation
Step 1: Enable Video Capture When Entering a Room
Before calling enterRoom as part of Step 2 in AI Real-Time Voice Conversation (Three-Stage) Integration, enable video capture.
First, call muteLocalVideo to ensure the video is not published to the audio/video backend. Then, call startLocalPreview to start video capture:
trtc.muteLocalVideo(TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG, true);trtc.startLocalPreview(false, view);
Step 2: Connect to the AI Bot
Confirm that you have successfully connected to the AI bot. For details, see: Connect to AI Bot (Client).
Step 3: Use Visual Understanding Capabilities
1. Ask questions directly about the current camera feed in real time. The client will capture frames as needed and upload them to the AI backend, which will send the screenshot and the user's voice query to the multimodal large model.
2. To upload a specific image and query the AI, call callExperimentalAPI with a
json-formatted sendImage command:{"api": "aiConversation","params": {"command": "sendImage","robotid": "<Robot User Id>","payload": {"format": "jpeg","image": "<Base64 JPEG>"}}}
Note:
The
sendImage command only accepts JPEG images encoded in Base64. On success, no callback is triggered. On failure, error details are returned via the onCommand event.sendImage to upload any properly formatted image, such as images from the device album or screenshots captured with the TRTC Screenshot API (for frame-specific queries):trtc.snapshotVideo("", TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG,TRTCCloudDef.TRTC_SNAPSHOT_SOURCE_TYPE_VIEW,new TRTCCloudListener.TRTCSnapshotListener() {@Overridepublic void onSnapshotComplete(Bitmap bitmap) {if (bitmap == null) {return;}try {ByteArrayOutputStream out = new ByteArrayOutputStream();bitmap.compress(Bitmap.CompressFormat.JPEG, 80, out);// After Base64 encoding the JPEG data, call the hidden API aiConversation's sendImage command to send}catch (Exception e) {e.printStackTrace();}}});
Cloud Storage Archiving
When
StorageType=1 and CloudStorage are set, the backend asynchronously uploads each received screenshot to your specified cloud storage bucket for archiving, using the following object path structure:vision/{SdkAppId}/{YYYYMMDD}/{TaskId}/{captureTs}_{reason}_{frameId}.jpg
Path Field | Description |
SdkAppId | Application ID. |
YYYYMMDD | Screenshot date. |
TaskId | Task ID. |
captureTs | Screenshot timestamp. |
reason | Reason for screenshot (e.g., scene_change). |
frameId | Frame ID. |
After each batch of screenshots is uploaded, a screenshot upload callback is sent to your backend, including details such as screenshot time, reason, object key, and size. For more information, see AI Conversation Callback Events.
Note:
If
CloudStorage is not configured, screenshots are only held in backend memory for use during the current conversation and are not persisted or archived.Notes
A multimodal model is required: If
LLMConfig.Model is set to a text-only model, enabling VLM will not provide visual understanding.No runtime updates:
VisionConfig (including Enable, StorageType, and CloudStorage) cannot be changed via the task modification interface. You must recreate the task to apply changes.Cascade mode only: In S2S mode, audio is sent directly to the end-to-end model, and visual understanding is not available.
