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 upon receiving 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 playback. If the delay exceeds the audio delay, the SDK triggers the callback immediately upon receiving the packet, which 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: Synchronize the data stream with the audio stream. This setting is suitable for special scenarios such as lyrics synchronization.
  • false: Do not synchronize the data stream with the audio stream. This setting is suitable for scenarios where data packets need to reach the receiver immediately.
When 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 playback.
ordered
Whether to ensure the received data is in the same order as sent.
  • true: Ensures the SDK outputs data packets in the order sent by the sender.
  • false: Does not ensure 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.