Set Track Settings (Video/Audio)

You can customize local peer's Audio & Video track settings while creating instance of 100ms SDK.

These settings are a optional parameter and meant to be passed in the build function as trackSettings parameter which is a HMSTrackSettings object.

HMSSDK .Builder(application) .setTrackSettings(trackSettings) // track setting ... .build()

You can set the quality and description of the Audio tracks with setiings like initialState(), setUseHardwareAcousticEchoCanceler() etc

val trackSettings = HMSTrackSettings.Builder() .audio( HMSAudioTrackSettings.Builder() .setUseHardwareAcousticEchoCanceler(true/false) .initialState(MUTED/UNMUTED) .build())

Similarly, for Video tracks you can use like cameraFacing(), resolution(), forceSoftwareDecoding() etc

val trackSettings = HMSTrackSettings.Builder() .video( .disableAutoResize(true/false) .forceSoftwareDecoder(true/false) .initialState(MUTED/UNMUTED) .build())


Property specifies which camera to open while joining. It can be toggled later on. Default value is set as HMSCameraFacing.FRONT

HMSCameraFacing.FRONT HMSCameraFacing.BACK


This can be used when alot of video is rendered at a single time. It is known that hardware decoder on certain phones don't tend to work well with large grids. This may cause adverse effect like phone heating up, use this flag only when required. Default value is set as false

HMSVideoTrackSettings.Builder() .forceSoftwareDecoder(true) ...


The SDK intelligently downscales the resolution when, publisher's bandwidth is flaky or is cpu bound. This resuls in a low resolution to the viewers. But if the viewers are persistent they want highest resolution at all times, then this setting comes in handy. Default value is set as false

HMSVideoTrackSettings.Builder() .disableAutoResize(true) ...


This keeps the inital state for a particular role or when a new role is assigned. Usecase : user might want to turn on/off before joining the call. Default value is set as HMSTrackSettings.InitState.UNMUTED

.initialState(HMSTrackSettings.InitState.MUTED) ... HMSTrackSettings.InitState.MUTED/ HMSTrackSettings.InitState.UNMUTED


This setting use's the phone's Acoustic echo Cancellation instead of relying on the SDK's software based implementation. Default value is set as true

HMSVideoTrackSettings.Builder() .setUseHardwareAcousticEchoCanceler(true) ...


This setting is used to enable/disable sdk's audio manager, On disabling audio manager the app developer takes in responsibilty of manging audio routes

HMSAudioTrackSettings.Builder() .setDisableInternalAudioManager(true) // by default it's false ...

Here's a sample implementation of adding track settings while initializing 100ms SDK -

val hmsTrackSettings = HMSTrackSettings.Builder() .audio( HMSAudioTrackSettings.Builder() .setUseHardwareAcousticEchoCanceler(true) .initialState(HMSTrackSettings.InitState.MUTED) .build() ) .video( HMSVideoTrackSettings.Builder().disableAutoResize(false) .forceSoftwareDecoder(true) .initialState(HMSTrackSettings.InitState.MUTED) .build() ) .build() HMSSDK .Builder(application) .setTrackSettings(hmsTrackSettings) .build()

Have a suggestion? Recommend changes ->

Was this helpful?