通知
本站点除 Legacy 产品与方案外,已迁移至 声网新文档中心 ,当前页面不再维护
Documentation
All
Console 官网 Community Technical support

How can I enable in-ear monitoring?

Type: Integration issues    Platform: Android / iOS / Unity   Last Updated: 2022/09/14 23:49:32

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 RTC 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.

The Agora SDK provides the enableInEarMonitoring and setInEarMonitoringVolume methods to set the in-ear monitoring according to the scenario. These methods can be called before and after joining a channel, and only supports Android and iOS platforms.

Sample code

// Java
// Enables in-ear monitoring. The default value is false.
rtcEngine.enableInEarMonitoring(true);

// Sets the volume of the in-ear monitor. The value ranges between 0 and 100. The default value is 100, which represents the original volume captured by the microphone.
int volume = 80;
rtcEngine.setInEarMonitoringVolume(volume);
// Swift
// Enables in-ear monitoring. The default value is false.
agoraKit.enable(inEarMonitoring: true)

// Sets the volume of the in-ear monitor. The value ranges between 0 and 100. The default value is 100, which represents the original volume captured by the microphone.
agoraKit.setInEarMonitoringVolume(50)
// Objective-C
// Enables in-ear monitoring. The default value is NO.
[agoraKit enableInEarMonitoring:YES];

// Sets the volume of the in-ear monitor. The value ranges between 0 and 100. The default value is 100, which represents the original volume captured by the microphone.
[agoraKit setInEarMonitoringVolume: 50];
// C#
// Enables in-ear monitoring. The default value is false.
int ret = mRtcEngine.EnableInEarMonitoring(true);

// Sets the volume of the in-ear monitor. 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(50);

API reference

Considerations

  • Call enableInEarMonitoring before setInEarMonitoringVolume.
  • The API methods have return values. If the method call fails, the return value is < 0.
  • Since v3.1.0, you can experience a shorter delay of in-ear monitoring on the following Android devices:
    • OPPO Reno4 Pro 5G
    • OPPO Reno4 5G