Skip to navigation

setEchoCancellation

View as MarkdownOpen in Claude
setEchoCancellation(enabled): Promise<boolean>

Toggle echo cancellation on the local mic at runtime. Applied via track.applyConstraints; browsers that don’t honour runtime constraints (notably iOS Safari) fall back to re-acquiring the track with the new constraint set and plumbing the replacement through the local audio pipeline if one is active.

Parameters

enabled
booleanRequired

Whether echo cancellation should be enabled.

Returns

Promise<boolean> — whether the constraint reached the microphone.

false is an outcome rather than an error: a leg sending media the SDK did not capture is left alone. A UI that reflects the toggle must read this value instead of assuming the call succeeded. Any failure behind a false is also reported on errors$.

Examples

Toggle from a UI switch

echoSwitch.addEventListener('change', async (e) => {
const applied = await call.setEchoCancellation(e.target.checked);
echoSwitch.checked = applied ? e.target.checked : !e.target.checked;
});

See