DataStreamConfig
Used to configure synchronization and ordering behavior of data streams.
public class DataStreamConfig {
public boolean syncWithAudio = false;
public boolean ordered = false;
}
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 data packet is received. |
| true | false | If the data packet delay is within the audio delay range, the SDK triggers the callback when the synchronized audio is played; otherwise, it triggers the callback immediately. |
| false | true | If the data packet delay is less than 5 seconds, the SDK reorders it; otherwise, the packet is discarded. |
| true | true | If the data packet delay is within the audio delay range, the SDK reorders it; otherwise, the packet is discarded. |
Properties
- syncWithAudio
- Whether to synchronize the data packet with the published audio packet.
- true: Synchronize data packets with audio packets, suitable for special scenarios such as lyric synchronization.
- false: Do not synchronize data packets with audio packets, suitable for scenarios that require immediate delivery of data packets to the receiver.
- ordered
- Whether to ensure the receiver receives data in the sending order.
- true: The receiver receives data in the sending order.
- false: Receiving order is not guaranteed.