sendSEIMsg abstract method
Use SEI channel to send custom message to all users in room
This API allows you to use TRTC's SEI channel to broadcast custom data to other users in the current room for signaling transfer.
The header of a video frame has a header data block called SEI. This API works by embedding the custom signaling data you want to send in the SEI block and sending it together with the video frame.
Therefore, the SEI channel has a better compatibility than sendCustomCmdMsg as the signaling data can be transferred to the CSS CDN along with the video frame.
However, because the data block of the video frame header cannot be too large, we recommend you limit the size of the signaling data to only a few bytes when using this API.
The most common use is to embed the custom timestamp into video frames through this API so as to implement a perfect alignment between the message and video image (such as between the teaching material and video signal in the education scenario).
Other users in the room can receive the message through the TRTCCloudListener.onRecvSEIMsg .
Parameters:
- data(String):
- Data to be sent, which can be up to 1 KB (1,000 bytes).
- repeatCount(int):
- Data sending count.
Note: This API has the following restrictions:
- The data will not be instantly sent after this API is called; instead, it will be inserted into the next video frame after the API call.
- Up to 30 messages can be sent per second to all users in the room (this limit is shared with sendCustomCmdMsg).
- Each packet can be up to 1 KB (this limit is shared with sendCustomCmdMsg). If a large amount of data is sent, the video bitrate will increase, which may reduce the video quality or even cause lagging.
- Each client can send up to 8 KB of data in total per second (this limit is shared with sendCustomCmdMsg).
- If multiple times of sending is required (i.e.,
repeatCount
1), the data will be inserted into subsequent
repeatCount
video frames in a row for sending, which will increase the video bitrate. - If
repeatCount
is greater than 1, the data will be sent for multiple times, and the same message may be received multiple times in the TRTCCloudListener.onRecvSEIMsg callback; therefore, deduplication is required.
Return Description:
true
: the message is allowed and will be sent with subsequent video frames;false
: the message is not allowed to be sent.
Implementation
bool sendSEIMsg(String data, int repeatCount);