Field | Type | Description |
type | Number | Message type. 10000 indicates real-time subtitles. |
sender | String | User ID of the sender. |
receiver | Array | List of receivers' user IDs. The message is actually broadcasted in the room. |
payload | Object | Message payload. It contains the detailed subtitle information. |
Field | Type | Description |
text | String | Original text recognized by ASR(STT). |
start_time | String | Start time of a sentence. Format: "HH:MM:SS". |
end_time | String | End time of a sentence. Format: "HH:MM:SS". |
roundid | String | Unique ID that identifies a conversation round. |
end | Boolean | If the value is true, the sentence is a complete one. |
{"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(Tencent RTC.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) {// The subtitle is not complete.} else if (jsonData.type == 10000 && jsonData.payload.end == true) {// The sentence is finished.}});
Feedback