muteLocalAudio abstract method

void muteLocalAudio(
  1. bool mute
)

Pause/Resume publishing local audio stream

After local audio publishing is paused, other users in the room will receive the TRTCCloudListener.onUserAudioAvailable notification indicating that the user's audio is no longer available (userId, false).

After local audio publishing is resumed, other users in the room will receive the TRTCCloudListener.onUserAudioAvailable notification indicating that the user's audio is available again (userId, true).

Different from stopLocalAudio, muteLocalAudio (true) does not release the mic permission; instead, it continues to send mute packets with extremely low bitrate.

This is very suitable for scenarios that require on-cloud recording, as video file formats such as MP4 have a high requirement for audio continuity. An MP4 recording file cannot be played back smoothly if stopLocalAudio is used.

Therefore, muteLocalAudio instead of stopLocalAudio is recommended in scenarios where the requirement for recording file quality is high.

Parameters:

  • mute(bool):
    • true: mute;
    • false: unmute.

Implementation

void muteLocalAudio(bool mute);