setLocalAudio(bool, {forceDiscardTrack})


Updates the local mic state. Does nothing if not in a call.

Returns this.

Discarding the track

By default, setLocalAudio(false) disables the mic track without discarding it, meaning that Daily will keep your microphone hardware turned on even when muted. This is the default because it enables the user to unmute and immediately begin speaking without their first few words getting clipped while the microphone turns on. This is strongly recommended for most apps.

If it's important to your app to let the microphone turn all the way off (to hide browser- or OS-level mic-in-use indicators, say) then you can pass the forceDiscardTrack: true option when muting.

Note that if you only want to ensure that the mic-in-use indicators don't come on before the first time the user unmutes their mic (in the case where the call is configured with startAudioOff: true, say), then there's another tool at your disposal: the alwaysIncludeMicInPermissionPrompt: false call option.