Volume control and mute
This page shows you how to configure volume settings for audio recording, audio playback, and for the playback of music files.
Understand the tech
Agora Voice SDK supports adjusting the audio volume for both recording and playback to meet practical application scenarios. For example, during a two-person call, you can mute a remote user by adjusting the playback volume setting to 0.
Prerequisites
Ensure that you have implemented the SDK quickstart in your project.
Implement volume control
Use one or more of the following volume control methods to adjust volume settings.
The Agora SDK provides a setVolume
method for both local and remote audio track objects to adjust the volume of local audio capture and remote audio playback.
Adjust the playback volume of remote audio
In this example, remoteUser
refers to a subscribed remote user object.
Mute the local audio stream
To mute or unmute the local audio track, call setMuted
or setEnabled
:
Adjust the capture volume of local audio
In this example, localAudioTrack
is the local audio track object you created.
Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.