Field | Type | Description |
type | Number | Message type. 10000 indicates real-time captions. |
sender | String | The userID of the speaker. |
receiver | Array | The list of receiver userIDs. This message is actually broadcast within a room. |
payload | Object | Message payload, containing detailed caption information. |
Field | Type | Description |
text | String | Original text from Automatic Speech Recognition (ASR). |
start_time | String | Start time of this sentence. Format: "HH:MM:SS". |
end_time | String | End time of this sentence. Format: "HH:MM:SS". |
roundid | String | Unique ID for a round of conversation. |
end | Boolean | If it is true, it indicates that this is a complete sentence. |
{ "type": 10000, "sender": "user_a", "receiver": [], "payload": { "text": "Hello. Nice to meet you.", "start_time": "00:00:01", "end_time": "00:00:03", "roundid": "conversation_123456", "end": true } }
trtcClient.on(TRTC.EVENT.CUSTOM_MESSAGE, (event) => { let data = new TextDecoder().decode(event.data); let jsonData = JSON.parse(data); console.log(`receive custom msg from ${event.userId} cmdId: ${event.cmdId} seq: ${event.seq} data: ${data}`); if (jsonData.type == 10000 && jsonData.payload.end == false) { // Intermediate state of captions } else if (jsonData.type == 10000 && jsonData.payload.end == true) { // End of a sentence } });