logo
On this page

Geofencing

2024-01-02

Feature overview

Geofencing refers to limiting the transmission of audio, video and signaling data to a certain region to comply with regional data privacy and security regulations, that is, limiting access to audio and video services in a specific region. For example, when the specified geofencing region is Europe, regardless of the region where the App user is located, the region actually accessed by the SDK will be Europe.

Specified geofencing regionApp user regionSDK actual access regionUser experience after connection
EuropeEuropeEuropeNormal
EuropeChinaEuropeMay be significantly affected
Warning
  • If all servers in the specified geofencing region are unavailable, the SDK will directly report an error.
  • Since there is a cross-regional public Internet between the specified geofencing region and the App user region, poor public Internet network quality will affect the audio and video experience.

The currently supported SDK configuration regions are as follows:

Note

For support for more regions, please contact ZEGO Technical Support.

RegionEnumeration
China, excluding Hong Kong, Macao and TaiwanCN
North AmericaNA
IndiaIN
EuropeEU
Asia, excluding China and IndiaAS

Prerequisites

Before using the geofencing feature, please ensure:

Implementation process

Enable geofencing permission

Geofencing capability may require payment in some cases. Please contact ZEGO Business to confirm and enable geofencing permission.

Set geofencing

  • Geofencing information: Includes geofencing type and geofencing region list.
  • Geofencing type: Includes two types: Include and Exclude. The geofencing type will act on the geofencing region list.
    • Include: Indicates that all regions in the region list are included within the geofencing.
    • Exclude: Indicates that all regions in the region list are excluded from the geofencing.

Before creating the SDK, call the setGeoFence interface to set geofencing information.

Warning

Please configure geofencing information before calling createEngine, otherwise it will be invalid.

// Example of setting Include mode
const geofence_type = zgDefines.ZegoGeoFenceType.Include;//Set Include mode
// Set region list information, at least 1 must be set, at most not greater than the number supported by the SDK
let geofence_area_list= [2, 3]  // 2-ZegoGeoFenceAreaCode.CN  3-ZegoGeoFenceAreaCode.NA
zgEngine.setGeoFence(geofence_type, geofence_area_list)  //Call before createEngine

// Example of setting Exclude mode
const geofence_type = zgDefines.ZegoGeoFenceType.Exclude;//Set Exclude mode
// Set region list information, at least 1 must be set, at most not greater than the number supported by the SDK
let geofence_area_list= [2, 3]  //2-ZegoGeoFenceAreaCode.CN  3-ZegoGeoFenceAreaCode.NA
zgEngine.setGeoFence(geofence_type, geofence_area_list)  //Call before createEngine

Integrate other features

After completing the geofencing settings, you can proceed with other feature integration.

Previous

Traffic Control

Next

Common Video Configuration

On this page

Back to top