onWTNDataMessageReceived method
FutureOr<void>
onWTNDataMessageReceived(
- dynamic streamId,
- dynamic message,
- dynamic sourceType
override
@detail callback
@valid since 3.60.
@author hanchenchen
@brief The data information contained in the callback of WTN stream..
After calling subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream}/subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}, you can listen to this callback and retrieve SEI messages inserted by Open API calls or audio volume.
@param streamId ID of the WTN stream
@param message The received data message's content is as follows:
- Data inserted by calling the OpenAPI.
- Media volume in JSON, before you can receive which you need to enable it via calling the OpenAPI. Refer to the definition below to parse the JSON string.
{
"Type" : "VolumeIndication", //Specific business type.
"VolumeInfos" : [ // Business type corresponding information
{
"RoomId":"1000001", // Room ID
"UserId":"1000001", // User ID
"StreamType":0, // 0:camera stream;1:screen stream
"LinearVolume":1 // LinearVolume
}
@param sourceType Message source. See DataMessageSourceType{@link #DataMessageSourceType}. @note You also need to listen to onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived} to receive SEI inserted via API by the client SDK. @order 6
Implementation
FutureOr<void> onWTNDataMessageReceived(
dynamic streamId, dynamic message, dynamic sourceType) async {
if ($instance == null || $instance is! IWTNStreamEventHandler) {
return;
}
return ($instance as IWTNStreamEventHandler).onWTNDataMessageReceived?.call(
streamId.toString(),
message,
t_DataMessageSourceType.android_to_code(
$p_a.DataMessageSourceType.values.firstWhere(
(t) => t.$value == sourceType || t.name == sourceType)));
}