DataStreamConfig
Data stream settings.
class DataStreamConfig {
const DataStreamConfig({this.syncWithAudio, this.ordered});
@JsonKey(name: 'syncWithAudio')
final bool? syncWithAudio;
@JsonKey(name: 'ordered')
final bool? ordered;
factory DataStreamConfig.fromJson(Map<String, dynamic> json) =>
_$DataStreamConfigFromJson(json);
Map<String, dynamic> toJson() => _$DataStreamConfigToJson(this);
}
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 a 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 delay exceeds the audio delay, the SDK triggers the callback immediately upon receiving the data 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: The data stream is synchronized with the audio stream. Suitable for scenarios like lyrics synchronization.
- false: The data stream is not synchronized with the audio stream. Suitable for scenarios where data packets need to reach the receiver immediately.
- ordered
- Whether to ensure the received data is in the same order as sent.
- true: Ensures the SDK outputs data packets in the same order as sent.
- false: Does not ensure the SDK outputs data packets in the same order as sent.