100ms Logo

100ms

Docs

Search docs
/

Set Track Settings

Sometimes it is required to customize local peer's Audio & Video track settings while creating instances of 100ms SDK.

These settings are optional parameters and are meant to be passed in the HMSSDK function as the hmsTrackSetting parameter which is an HMSTrackSettings object.

For the Audio track we can set the following properties :

  • useHardwareAcousticEchoCanceler - Property to enable Hardware echo cancellation. By default, it's set to true if the device supports it. Please note that on some devices the hardware wrongly reports the HW echo canceler to be present whereas it does not work In such cases, the application needs to set this to false, so that SW echo canceler is picked up
  • audioSource - Property to configure audio nodes mainly used in iOS for audio sharing.
  • trackInitialState - Property to set the initial state of the audio track i.e Mute/Unmute.More info about this can be found here

For the Video track we can set the following properties :

  • cameraFacing - Property specifies which camera to open while joining. It can be toggled later on. The default value is HMSCameraFacing.FRONT.
HMSCameraFacing.FRONT HMSCameraFacing.BACK
  • disableAutoResize - Property to disable auto-resizing.
  • trackInitialState - Property to set the initial state of the video track i.e Mute/Unmute.More info about this can be found here

How to add track settings while initializing HMSSDK

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

HMSAudioTrackSetting audioTrackSetting = HMSAudioTrackSetting( useHardwareAcousticEchoCanceler: false, trackInitialState: HMSTrackInitState.UNMUTED ); HMSVideoTrackSetting videoTrackSetting = HMSVideoTrackSetting( cameraFacing: HMSCameraFacing.FRONT, trackInitialState: HMSTrackInitState.UNMUTED ); HMSTrackSettings trackSettings = HMSTrackSetting( audioTrackSetting: audioTrackSetting, videoTrackSetting: videoTrackSetting ); HMSSDK hmsSDK = HMSSDK(hmsTrackSetting: trackSettings);

You can fetch the track Settings using the method after the build method is called as follows -

HMSTrackSettings trackSettings = hmsSDK.getTrackSettings();