In-ear monitoring provides a mix of the audio sources (for example, a mix of the vocals and music) to the host with low latency, commonly used in professional scenarios, such as in concerts.
The Agora SDK supports the in-ear monitoring function and volume adjustment of the in-ear monitor.

Implementation

Before using the in-ear monitoring function, ensure that you have implemented the basic real-time communication functions in your project. For details, see Start a Call or Start Live Interactive Streaming for details.

The Agora SDK provides the EnableInEarMonitoring and SetInEarMonitoringVolume to set the in-ear monitoring according to the scenario, you can use these methods no matter before or after JoinChannelByKey.

EnableInEarMonitoring and SetInEarMonitoringVolume are for Android and iOS only.

Sample code

// Enables in-ear monitoring. The default value is false.
int ret = mRtcEngine.EnableInEarMonitoring(true);

// Sets the volume of the in-ear monitor as 80% of the original volume. The value ranges between 0 and 100. The default value is 100, which represents the original volume captured by the microphone.
int ret = mRtcEngine.SetInEarMonitoringVolume(80);

API reference

Considerations

  • Call EnableInEarMonitoring before SetInEarMonitoringVolume.
  • The API methods have return values. If the method call fails, the return value is < 0.