setMicrophoneEnabled method
Future<Result<None> >
setMicrophoneEnabled({
- required bool enabled,
- AudioConstraints? constraints,
Implementation
Future<Result<None>> setMicrophoneEnabled({
required bool enabled,
AudioConstraints? constraints,
}) async {
final result = await _session?.setMicrophoneEnabled(
enabled,
constraints: constraints,
) ??
Result.error('Session is null');
if (result.isSuccess) {
_stateManager.participantSetMicrophoneEnabled(
enabled: enabled,
);
_connectOptions = _connectOptions.copyWith(
microphone: enabled ? TrackOption.enabled() : TrackOption.disabled(),
);
if (_connectOptions.audioOutputDevice != null) {
await setAudioOutputDevice(_connectOptions.audioOutputDevice!);
}
}
return result;
}