Set Track Settings

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.

You can set the quality and description of the Audio tracks with props like maxBitrate and trackDescription.

Similarly, for Video tracks you can use props like maxBitrate, maxFrameRate, cameraFacing, resolution and trackDescription.

maxBitrate

Property specifies the maximum number of bits per second to allow a track.

maxFrameRate

Frames Per Second is used to measure frame rate – the number of consecutive full-screen images that are displayed each second

cameraFacing

Property specifies which camera to open while joining. It can be toggled later on.

HMSCameraFacing.FRONT HMSCameraFacing.BACK

resolution

Video resolution is the number of pixels contained in each frame. Video resolution determines the amount of detail in your video or how realistic and clear the video appears.

import HmsManager, { HMSAudioTrackSettings, HMSAudioCodec, HMSVideoTrackSettings, HMSVideoCodec, HMSCameraFacing, HMSVideoResolution, HMSTrackSettings } from '@100mslive/react-native-hms'; const getTrackSettings = () => { let audioSettings = new HMSAudioTrackSettings({ codec: HMSAudioCodec.opus, maxBitrate: 32, trackDescription: 'Simple Audio Track', }); let videoSettings = new HMSVideoTrackSettings({ codec: HMSVideoCodec.VP8, maxBitrate: 512, maxFrameRate: 25, cameraFacing: HMSCameraFacing.FRONT, trackDescription: 'Simple Video Track', resolution: new HMSVideoResolution({height: 180, width: 320}), }); return new HMSTrackSettings({ video: videoSettings, audio: audioSettings, useHardwareEchoCancellation: false // true if its not handled automatically }); } const trackSettings = getTrackSettings(); const build = await HmsManager.build({trackSettings});

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

const getTrackSettings = () => { let audioSettings = new HMSAudioTrackSettings({ maxBitrate: 32, trackDescription: "Simple Audio Track" }); let videoSettings = new HMSVideoTrackSettings({ codec: HMSVideoCodec.vp8, maxBitrate: 512, maxFrameRate: 25, cameraFacing: HMSCameraFacing.FRONT, trackDescription: "Simple Video Track", resolution: new HMSVideoResolution({height: 180, width: 320})}); return new HMSTrackSettings({video: videoSettings, audio: audioSettings}); } const setupBuild = async () => { const trackSettings = getTrackSettings(); const build = await HmsManager.build({ trackSettings }); setInstance(build); updateHms({hmsInstance: build}); };