Geofencing
Feature Overview
Geofencing refers to restricting the transmission of audio, video, and signaling data to a specific region to comply with regional data privacy and security regulations, that is, limiting 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 | Actual region accessed by SDK | 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 directly report an error.
- Due to the cross-region public internet between the specified geofencing region and the App user's region, poor public internet quality will affect the audio and video experience.
The currently supported regions for SDK configuration are as follows:
If you need support for more regions, please contact ZEGOCLOUD Technical Support.
| Region | Enumeration |
|---|---|
| Mainland China, excluding Hong Kong, Macao, and Taiwan | CN |
| North America | NA |
| India | IN |
| Europe | EU |
| Asia, excluding Mainland China and India | AS |
Prerequisites
Before using the geofencing feature, ensure that:
- A project has been created in the ZEGOCLOUD Console and valid AppID and AppSign have been obtained. For details, please refer to Console - Project Information.
- ZEGO Express SDK has been integrated into your project and basic audio and video streaming functions have been implemented. For details, please refer to Quick Start - Integration and Quick Start - Implementation.
Implementation Flow
Enable Geofencing Permission
Geofencing capability may require payment 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 apply to 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 calling createEngine, otherwise it will be invalid.
// Example of setting Include mode
//Set Include mode
ZegoGeoFenceType type = ZegoGeoFenceType::ZEGO_GEO_FENCE_TYPE_INCLUDE;
// Set region list information, at least 1, at most not more than the number supported by the SDK
std::vector<int> areaList;
areaList.push_back((int)ZegoGeoFenceAreaCode::ZEGO_GEO_FENCE_AREA_CODE_CN);
areaList.push_back((int)ZegoGeoFenceAreaCode::ZEGO_GEO_FENCE_AREA_CODE_NA);
// This interface is a static method, called before createEngine
ZegoExpressSDK::setGeoFence(type, areaList);
// Example of setting Exclude mode
//Set Exclude mode
ZegoGeoFenceType type = ZegoGeoFenceType::ZEGO_GEO_FENCE_TYPE_EXCLUDE;
// Set region list information, at least 1, at most not more than the number supported by the SDK
std::vector<int> areaList;
areaList.push_back((int)ZegoGeoFenceAreaCode::ZEGO_GEO_FENCE_AREA_CODE_CN);
areaList.push_back((int)ZegoGeoFenceAreaCode::ZEGO_GEO_FENCE_AREA_CODE_NA);
// This interface is a static method, called before createEngine
ZegoExpressSDK::setGeoFence(type, areaList);Integrate Other Features
After completing the geofencing settings, you can proceed with integrating other features.
