LocalAudio

The LocalAudio model allows enabling and disabling the local participant's audio as well as setting and checking the capture mode and comfort noise level.

Methods

applyConstraints

applyConstraints(constraints: MediaTrackConstraints): Promise

Applies a set of audio constraints to an audio track to allow setting ideal values and acceptable value ranges of constrainable properties of the track, such as echo cancellation and noise suppression. The method does not allow setting the deviceId and groupId constraints. If the required constraints are too strict to find a match during a track configuration attempt, the promise is rejected with the OverconstrainedError. We recommend using this method for applying constraints; MediaStreamTrack.applyconstraints() may not work as expected.

The method is supported in SDK 3.7 and later and is available only for users who use the Opus codec. The method may be rejected and trigger the UnsupportedError after being called by a listener, a participant who uses the Dolby Voice Codec or sends audio from a custom track, or an application user who is not in a conference or whose local audio track is not started.

The method may require a few seconds to become effective because some constraints of an audio track must be recreated.

Parameters:

NameTypeDescription
constraints?MediaTrackConstraintsThe audio constraints.

Returns: Promise


getCaptureMode

getCaptureMode(): Promise<AudioCaptureModeOptions>

Returns the local participant's audio capture mode in Dolby Voice conferences. The method is supported in SDK 3.7 and later.

Returns: Promise<AudioCaptureModeOptions>


setCaptureMode

setCaptureMode(options: AudioCaptureModeOptions): Promise<void>

Sets the local participant's audio capture mode. The following modes are available:

  • Standard: The default mode aimed at enhancing speech to create a conversation-focused conference environment. This mode optimizes captured audio for speech by aggressively removing non-speech content, such as background noise. The mode additionally allows using VoiceFonts. The mode is supported in SDK 3.7 and later.

  • Music: Allows transmitting a high-quality audio stream and is designed to improve the perceptual quality of music content. This mode is perfect for music lessons, virtual concerts, and music-focused webinars. The mode is supported in SDK 3.8 and later for Dolby Voice conferences and SDK 3.10 and later for non-Dolby Voice conferences.

  • Unprocessed: Disables audio processing and increases the quality to enable audio to be transmitted transparently into a conference. The mode is supported in SDK 3.7 and later.

Parameters:

NameTypeDescription
optionsAudioCaptureModeOptionsThe preferred audio capture mode and additional settings for the selected mode.

Returns: Promise<void>


getComfortNoiseLevel

getComfortNoiseLevel(): Promise<ComfortNoiseLevel>

Returns the comfort noise level setting for output devices. Getting the comfort noise level is supported only for users who use the Dolby Voice Codec in Dolby Voice conferences. The method is available in SDK 3.7 and later.

Returns: Promise<ComfortNoiseLevel>


setComfortNoiseLevel

setComfortNoiseLevel(level: ComfortNoiseLevel): Promise<void>

Sets the comfort noise level for output devices. Setting the comfort noise level is supported only for users who use the Dolby Voice Codec in Dolby Voice conferences. The method is available in SDK 3.7 and later.

Parameters:

NameTypeDescription
levelComfortNoiseLevelThe comfort noise level.

Returns: Promise<void>


start

start(constraints?: MediaTrackConstraints): Promise;

Starts transmitting audio from the local participant's microphone to a conference. The SDK automatically manages audio rendering, which means that an application does not need to implement its own <audio> element. The method is available in SDK 3.7 and later, requires a few seconds to become effective, and is not supported for listeners.

Returns: Promise


start

start(customTrack: MediaStreamTrack): Promise<MediaStreamTrack>

Starts transmitting the local participant's audio from a custom track to a conference. The method allows transmitting audio from a non-microphone source, which may be useful for adding bots to a conference or using custom audio processing. For the best experience, set the audio capture mode to Unprocessed if your custom track contains a non-speech content. The SDK automatically manages audio rendering, which means that an application does not need to implement its own <audio> element.

Note: The method supports audio tracks with sample rates of 16kHz, 32kHz, and 48kHz. Any other sample rates are not supported.

This method is available in SDK 3.9 and later and is not supported for listeners. Applying constraints to an audio track is not supported while using the method.

Returns: Promise<MediaStreamTrack>


stop

stop(): Promise<any>

Disables the local participant's audio and stops sending the audio to a conference. This method is supported in SDK 3.7 and later, requires a few seconds to become effective, and is not available for listeners.

Returns: Promise<any>