logo
On this page

Configure device performance levels


Introduction

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 LevelEnumerationEffect Difference
Low LevelLOW = 1Skin smoothing effect is average, skin changing effect is average, beauty makeups effect is average, acne and spot removal effect is average
Medium LevelMIDDLE = 2Skin smoothing effect is good, skin changing effect is good, beauty makeups effect is average, acne and spot removal effect is average
High LevelHIGH = 3Skin smoothing effect is good, skin changing effect is good, beauty makeups effect is good, acne and spot removal effect is good
Note

If the developer does not actively configure the device performance level, the default device performance level is HIGH, which is a high-performance device.

Steps to Use

Warning

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.

Method 1: Actively Get and Configure

  1. (Optional) Use getDeviceLevel to get the current device performance level.

    Untitled
    int deviceLevel = ZegoEffects.getDeviceLevel().value();
    
    1
    Copied!
  2. 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.

    Untitled
    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.valueOf(deviceLevel)); 
    config.setAdvancedConfig(map);
    ZegoEffects.setAdvancedConfig(config);
    
    1
    Copied!

Method 2: Configure via Configuration File

  1. Support customizing the device performance level through the CommonResources.bundle/device_level.json configuration file.
  2. After defining the device performance level, the corresponding device will run the AI Face beautification function according to the level configured in the configuration file.
    Untitled
    {
      ...
      whitelist: {
          // Get Device Name through Build.MODEL, such as HUAWEI P40
          "device_level_MIDDLE" = ["Device Name 1", "Device Name 2"]
      }
    }
    
    1
    Copied!

Previous

Implement Basic Image Processing

Next

Face Beautification