DataStreamConfig

Data stream settings.

export class DataStreamConfig {
  
  syncWithAudio?: boolean;
  
  ordered?: boolean;
}

The table below shows the SDK behavior under different parameter settings: 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 synchronized with the audio packet during audio playback. If the data packet delay exceeds the audio delay, the SDK immediately triggers the onStreamMessage callback upon receiving the packet; this may cause desynchronization between audio and data packets. false true If the data packet delay is within 5 seconds, the SDK corrects the packet disorder. 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 corrects the packet disorder. If the delay exceeds the audio delay, the SDK discards the packet.

Properties

syncWithAudio
Whether to synchronize with the locally sent audio stream.
  • true: The data stream is synchronized with the audio stream. This setting is suitable for special scenarios such as lyrics synchronization.
  • false: The data stream is not synchronized with the audio stream. This setting is suitable for scenarios where data packets need to reach the receiver immediately.
When data stream is synchronized with the audio stream, if the data packet delay is within the audio delay range, the SDK triggers the onStreamMessage callback synchronized with the audio packet during audio playback.
ordered
Whether to ensure that the received data is in the order it was sent.
  • true: Ensures that the SDK outputs data packets in the order sent by the sender.
  • false: Does not ensure that the SDK outputs data packets in the order sent by the sender.
If data packets need to reach the receiver immediately, do not set this parameter to true.