Geofencing
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 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 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:
For support for more regions, please contact ZEGO Technical Support.
| Region | Enumeration |
|---|---|
| China, excluding Hong Kong, Macao and Taiwan | CN |
| North America | NA |
| India | IN |
| Europe | EU |
| Asia, excluding China and India | AS |
Prerequisites
Before using the geofencing feature, please ensure:
- You have created a project in the ZEGOCLOUD Console and applied for valid AppID and AppSign. For details, please refer to Console - Project Information.
- You have integrated ZEGO Express SDK in the project and implemented basic audio and video publishing and playing functions. For details, please refer to Quick Start - Integration and Quick Start - Implementation.
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.
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 createEngineIntegrate other features
After completing the geofencing settings, you can proceed with other feature integration.
