DataStreamConfig

Struct used to configure data stream behavior.

struct DataStreamConfig {
  bool syncWithAudio;
  bool ordered;
};
The following table shows the SDK behavior under different parameter combinations:
syncWithAudio ordered SDK Behavior
false false The SDK immediately triggers the onStreamMessage callback when the receiver receives the data packet.
true false If the data packet delay is within the audio delay range, the SDK triggers the onStreamMessage callback when the synchronized audio packet is played; if the delay exceeds the audio delay, the SDK triggers the callback immediately upon receiving the data packet.
false true If the data packet delay is less than 5 seconds, the SDK performs order correction; if the delay exceeds 5 seconds, the SDK discards the packet.
true true If the data packet delay is within the audio delay range, the SDK performs order correction; if the delay exceeds the audio delay, the SDK discards the packet.

Properties

syncWithAudio
Whether to synchronize the data packet with the published audio packet.
  • true: Synchronize with audio packets, suitable for scenarios such as lyrics synchronization.
  • false: Do not synchronize with audio packets, suitable for scenarios where data packets need to arrive at the receiver immediately.
When set to sync, if the data packet delay is within the audio delay range, the SDK triggers the onStreamMessage callback when the corresponding audio is played.
ordered
Whether to ensure that the receiver receives data in the order sent.
  • true: Ensure that the receiver receives data in the order sent.
  • false: Do not ensure the order of data reception.
If you want the receiver to receive data packets immediately, do not set this parameter to true.