Skip to main content
Android
iOS
macOS
Web
Windows
Electron
Flutter
React Native
Python
React JS
Unity
Unreal Engine
Unreal (Blueprint)

Restrict media zones

When a user joins a channel, Voice SDK automatically connects them to the Agora SD-RTN™ media zone that is geographically closest to the user. However, to meet the laws and regulations of the user's country, you may need to specify, or filter out connections to a specific geographical zone. Agora enables you to control and customize data routing in your app by specifying the Agora SD-RTN™ media zone users connect to.

information

This is an advanced feature suitable only for use-cases with access security restrictions.

Understand the tech

After you turn on the restricted media zones feature, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user. As an example, the following table shows the outcome if you specify North America as the access zone, and users connect to Agora SD-RTN™ from North America and China respectively:

Designated access zone User's location Zone actually accessed by the SDK User experience
North America North America North America Normal
China Quality may be affected
information
  • If a server in the specified zone is not available, the SDK reports an error.
  • Due to cross-regional public internet between the designated zone and the geographical location where the app user is located, the audio and video experience may be affected.

The following figure shows the workflow you implement to restrict access to media zones:

Restrict media zones

Restrict media zones

Prerequisites

Ensure that you have implemented the SDK quickstart in your project.

Implement restricted media zones

This section shows you how to restrict access to media zones in your app.

By default, the SDK connects to the nearest Agora server. You set the areaCode property by calling the setArea method to specify the media zone(s). After setting the access zone, the SDK only connects to Agora servers in the specified media zone.

You can set the area to:

  • ASIA : Asia except Mainland China
  • CHINA : Mainland China
  • EUROPE: European region
  • GLOBAL: Global (Default)
  • INDIA : India
  • JAPAN : Japan
  • NORTH_AMERICA: North America
information

Media zones support bitwise operations.

Refer to the following sample code:

const useMediaZones = () => {
useEffect(() => {
AgoraRTC.setArea({
areaCode: [AREAS.NORTH_AMERICA, AREAS.ASIA]
})
}, []);
};

function EnableMediaZones() {
useMediaZones();

return (
<div>
<App />
</div>
);
}
Copy

Reference

This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

Voice Calling