Geofencing
Feature Introduction
Geofencing refers to limiting audio, video, and signaling data transmission to a specific region to comply with regional data privacy and security regulations, which is to limit access to Video Call services in a specific region. For example, when the specified geofencing region is Europe, regardless of where the App users are located, the region actually accessed by the SDK will be Europe.
| Specified geofencing region | App user region | SDK actual access region | User experience after connection |
|---|---|---|---|
| Europe | Europe | Europe | Normal |
| Europe | China | Europe | May be significantly affected |
- If all servers in the specified geofencing region are unavailable, the SDK will report an error directly.
- Due to the cross-region public internet between the specified geofencing region and the App user region, poor public internet network quality will affect the Video Call experience.
The current SDK supports the following region configurations:
| Region | Enum | Value |
|---|---|---|
| China Mainland, excluding Hong Kong, Macao, and Taiwan | CN | 2 |
| North America | NA | 3 |
| Europe | EU | 4 |
| Asia, excluding China Mainland and India | AS | 5 |
| India | IN | 6 |
Prerequisites
Before using the geofencing feature, please ensure:
- You have created a project in the ZEGOCLOUD Console, applied for a valid AppID and Server URL. For details, please refer to Console - Project Information.
- You have integrated ZEGO Express SDK in the project and implemented basic Video Call stream publishing and playing features. For details, please refer to Quick Start - Integration and Quick Start - Implementation Flow.
Implementation Flow
Enable Geofencing Permission
Geofencing capabilities require fees in some cases. Please contact ZEGO sales to confirm and enable geofencing permissions.
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.
Please configure geofencing information before creating the ZegoExpressEngine engine instance, otherwise it will be invalid.
// Example of setting Include mode
const geofenceType = 1;// Set Include mode
const geofenceAreaList = [2,4]; // Set region list information, at least 1 must be set, maximum cannot exceed the number supported by the SDK
ZegoExpressEngine.setGeoFence(geofenceType, geofenceAreaList);// This interface is a static method, called before new ZegoExpressEngine
// Example of setting Exclude mode
const geofenceType = 2;// Set Exclude mode
const geofenceAreaList = [2,4];// Set region list information, at least 1 must be set, maximum cannot be greater than or equal to the number supported by the SDK
ZegoExpressEngine.setGeoFence(geofenceType, geofenceAreaList);// This interface is a static method, called before new ZegoExpressEngineIntegrate Other Features
After completing the geofencing settings, you can proceed with other feature integration.
