AI Effects supports configuring the device performance level that the SDK runs on, and can ensure that the AI Face beautification function can run smoothly and stably by configuring different Face beautification effects on devices with different performance levels. It is mainly used when the device performance is not sufficient to run advanced effects smoothly, and the goal of smooth operation is achieved by reducing the effects of some effects.
Device Performance Level | Enumeration | Effect Difference |
---|---|---|
Low Level | LOW = 1 | Skin smoothing effect is average, skin changing effect is average, beauty makeups effect is average, acne and spot removal effect is average |
Medium Level | MIDDLE = 2 | Skin smoothing effect is good, skin changing effect is good, beauty makeups effect is average, acne and spot removal effect is average |
High Level | HIGH = 3 | Skin smoothing effect is good, skin changing effect is good, beauty makeups effect is good, acne and spot removal effect is good |
If the developer does not actively configure the device performance level, the default device performance level is HIGH
, which is a high-performance device.
If the same device is used to configure the performance level in "Method 1" and "Method 2" respectively, the performance level configured by the configuration file in "Method 2" has a higher priority.
int deviceLevel = ZegoEffects.getDeviceLevel().value();
Before calling the create interface to create the ZegoEffects object, pass the device performance level to the SDK through setAdvancedConfig, and run the corresponding AI Face beautification effect according to the device performance level.
ZegoEffectsAdvancedConfig config = new ZegoEffectsAdvancedConfig();
HashMap<String,String> map = new HashMap<>();
int deviceLevel = ZegoEffects.getDeviceLevel().value();
// You can also force the device performance level to be set to another device performance level as shown in the example below
// Note: Low-performance devices can run Face beautification effects of high-performance devices, but may experience stuttering.
// int deviceLevel = ZegoEffectsDeviceLevel.HIGH.value();
// ZEGO_EFFECTS_DEVICE_LEVEL is an advanced configuration parameter, which can be viewed in ZegoEffects.java
map.put(ZegoEffects.ZEGO_EFFECTS_DEVICE_LEVEL, String.format("%d", deviceLevel));
config.setAdvancedConfig(map);
ZegoEffects.setAdvancedConfig(config);
{
...
whitelist: {
// Get Device Name through Build.MODEL, such as HUAWEI P40
"device_level_MIDDLE" = ["Device Name 1", "Device Name 2"]
}
}