var preferences = call.state.value.preferences;
Call Preferences Configuration
Call preferences allow you to configure various aspects of call behavior and performance. These settings control timeouts, reaction behavior, statistics reporting, and other call-specific functionality that affects the user experience during video calls.
Accessing Call Preferences
You can access the current preferences through the call state:
Available Preference Properties
Property | Type | Default Value | Description |
---|---|---|---|
connectTimeout | Duration | Duration(seconds: 60) | Timeout duration for establishing a connection to the call. |
reactionAutoDismissTime | Duration | Duration(seconds: 5) | Duration after which reactions are automatically dismissed. |
callStatsReportingInterval | Duration | Duration(seconds: 2) | Interval for reporting call statistics. |
dropIfAloneInRingingFlow | bool | true | Whether to drop the call if you’re alone in a ringing flow. |
closedCaptionsVisibilityDurationMs | int | 2700 | Duration (in ms) that closed captions remain visible. |
closedCaptionsVisibleCaptions | int | 2 | Number of closed caption lines to display simultaneously. |
clientPublishOptions | ClientPublishOptions? | null | Advanced video publishing options. |
Setting Custom Call Preferences
You can customize call preferences when creating a call:
final call = streamVideo.makeCall(
callType: StreamCallType.defaultType(),
id: 'my-call-id',
preferences: DefaultCallPreferences(
connectTimeout: Duration(seconds: 30),
reactionAutoDismissTime: Duration(seconds: 3),
dropIfAloneInRingingFlow: false,
closedCaptionsVisibleCaptions: 3,
closedCaptionsVisibilityDurationMs: 5000,
),
);
Updating Call Preferences During a Call
You can update call preferences during an active call:
call.updateCallPreferences(
DefaultCallPreferences(
reactionAutoDismissTime: Duration(seconds: 10),
closedCaptionsVisibleCaptions: 4,
),
);
Advanced Video Publishing Options
The clientPublishOptions
property allows you to control prefered video codec selection. Don’t use it unless you know what you are doing. Manually setting preferred codec can cause call stability/compatibility issues. Use with caution.
Client Publish Options
Configure video codec and quality settings:
final call = streamVideo.makeCall(
callType: StreamCallType.defaultType(),
id: 'my-call-id',
preferences: DefaultCallPreferences(
clientPublishOptions: ClientPublishOptions(
preferredCodec: PreferredCodec.h264,
fmtpLine: 'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f',
preferredBitrate: 1500000,
maxSimulcastLayers: 3,
),
),
);
Client Publish Options Properties
Property | Type | Description |
---|---|---|
preferredCodec | PreferredCodec? | Preferred video codec for publishing (VP8, H264, VP9, AV1). |
fmtpLine | String? | Format parameters line for the video codec. |
preferredBitrate | int? | Preferred bitrate in bits per second for video publishing. |
maxSimulcastLayers | int? | Maximum number of simulcast layers to publish. |
subscriberCodec | PreferredCodec? | Preferred codec for receiving video streams. |
subscriberFmtpLine | String? | Format parameters line for the subscriber codec. |