muteLocalAudioStream method Null safety

Future<void> muteLocalAudioStream(
  1. bool muted

Stops or resumes publishing the local audio stream.

Parameter muted Sets whether to stop publishing the local audio stream.

  • true: Stop publishing the local audio stream.
  • false: Resume publishing the local audio stream.

This method only sets the publishing state of the audio stream in the channel of AgoraRtcChannel.

A successful method call triggers the remoteAudioStateChanged callback on the remote client.

You can only publish the local stream in one channel at a time. If you create multiple channels, ensure that you only call muteLocalAudioStream(false) in one channel; otherwise, the method call fails, and the SDK returns -5 (Refused).


  • This method does not change the usage status of the audio-capturing device.
  • Whether this method call takes effect is affected by the joinChannel and setClientRole methods. For details, see Set the Publishing State.


Future<void> muteLocalAudioStream(bool muted) {
  return _invokeMethod('muteLocalAudioStream', {
    'muted': muted,