updateSendSettings()

updateSendSettings({sendSettings})

Compatibility:
Prebuilt
Custom

The updateSendSettings() method is used to modify how a client publishes both the local camera and custom video tracks. This method can be used to configure the simulcast layer encodings and to control which layers a client publishes.

Modifying these settings can help to improve the call quality when a user is connecting from a poor network or experiencing a high CPU load. Alternatively, these settings can be modified to improve visual performance when clients need to send higher quality video.

To make it easier to select the right layer, Daily provides three presets for common use cases:

  • 'quality-optimized': Optimized for good networks, resulting in higher resolutions at a higher bitrate.
  • 'bandwidth-and-quality-balanced': Designed to be flexible for most networks, resulting in high resolutions while conserving bandwidth.
  • 'bandwidth-optimized': Optimized for lower bandwidth networks, such as cellular networks. Delivers the best quality for bandwidth constrained connections.

In addition to the defined presets, you can reset the simulcast layers to their default settings by using the 'default' preset. The 'default' preset uses the 'bandwidth-and-quality-balanced' settings.

Send settings

Send settings are passed as an object with one of the following keys:

  • video:
    • Defines the simulcast settings that are used to publish the local camera.
  • customVideoDefaults:
    • Defines the simulcast settings that are used to publish custom video tracks.
  • [customKey: string]:
    • In case you wish to create a specific settings for a custom track, you can use the trackName as the key to define the video send settings.

Any of the keys above can take one of the presets or an object with the video send settings.

  • The available presets are: 'default', 'quality-optimized', 'bandwidth-and-quality-balanced', and 'bandwidth-optimized'.
  • Custom encodings are specified as RTCRtpEncodingParameters.
  • maxQuality specifies the highest simulcast layer published. The layer specified and all lower layers are published. For example, if a maxQuality of "medium" is set, then both the "medium" and "low" layers are published.

Examples

Change the local camera to use a different preset:

Change the default simulcast encodings used by custom video tracks:

Change a specific custom track, called myCustomVideo in this case, to use a maxQuality of "medium", which results in publishing both the low and medium simulcast layers:

Returns

A successful call to updateSendSettings() triggers an 'send-settings-updated' event, and returns a Promise that resolves with an object with the new send settings: