setLocalAudio()

setLocalAudio(bool, {forceDiscardTrack})

Compatibility:
Prebuilt
Custom

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

Returns this.

Audio only pricing

If you are building an audio-only app, please reach out to us at help@daily.co to enable audio-only pricing for your account.

For a call to be considered audio-only, it must contain no video tracks at any point. There are several ways to ensure this:

  • Start with video disabled when creating the room
  • Set videoSource: false when initializing the call object
  • Restrict video via meeting token permissions (set send permissions to audio-only)

Throughout the entire duration of the call, you must also ensure that no video tracks are added. If even one participant has an active video track, the call will be classified—and billed—as a video call.

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.