sendSEIMsg method
Use SEI channel to send custom message to all users in room
Different from how sendCustomCmdMsg works, sendSEIMsg directly inserts data into the video data header. Therefore, even if the video frames are relayed to CSS CDN, the data will always exist. As the data needs to be embedded in the video frames, we recommend you keep the data size under several bytes.
The most common use is to embed the custom timestamp into video frames through sendSEIMsg
. The biggest benefit of this scheme is that it can implement a perfect alignment between messages and video image.
Parameters:
data
Data to be sent, which can contain up to 1 KB (1,000 bytes) of data
repeatCount
Data sending count
Returned value:
true
: the message is allowed and will be sent to subsequent video frames; false
: the message is not allowed to be sent
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.
Platform not supported:
- web
- Windows
Implementation
Future<bool?> sendSEIMsg(String data, int repeatCount) {
return _cloudChannel!
.invokeMethod('sendSEIMsg', {"data": data, "repeatCount": repeatCount});
}