Al Effects supports configuring the device level on which the SDK runs, and can ensure the smooth and stable operation of AI Face beautification by configuring different Face beautification effects on devices with different performance levels. This 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 | ZegoEffectsDeviceLevelLow = 1 | Skin smoothing effect is average, skin color replacement effect is average, beauty makeups effect is average; acne and blemish removal effect is average |
High Level | ZegoEffectsDeviceLevelHigh = 3 | Skin smoothing effect is good, skin color replacement effect is good, beauty makeups effect is good; acne and blemish removal effect is good |
If the developer does not configure the device performance level actively, the default device performance level is ZegoEffectsDeviceLevelHigh
, which is the device of high performance level.
(Optional) Use getDeviceLevel to get the current device performance level.
ZegoEffectsDeviceLevel deviceLevel = [ZegoEffects getDeviceLevel];
Before calling the create interface to create a ZegoEffects object, pass the device performance level to the SDK through setAdvancedConfig to run the corresponding AI Face beautification effects based on the device performance level.
// Get the device performance level
ZegoEffectsAdvancedConfig *config = [ZegoEffectsAdvancedConfig alloc];
ZegoEffectsDeviceLevel deviceLevel = ZegoEffects.getDeviceLevel;
// If you want to experience the difference in performance, you can also ignore the actual device performance level and forcibly set it to another performance level as shown in the example below
// Note: Devices of low performance level can run Face beautification effects of high performance level devices, but there may be lag.
// ZegoEffectsDeviceLevel deviceLevel = ZegoEffectsDeviceLevel.ZegoEffectsDeviceLevelMiddle;
NSMutableDictionary<NSString *, NSString *> *mutableAdvancedConfig = [config.advancedConfig mutableCopy];
//ZEGO_EFFECTS_DEVICE_LEVEL is a parameter for advanced configuration, which can be viewed in ZegoEffects.h
[mutableAdvancedConfig setObject:[NSString stringWithFormat:@"%ld", deviceLevel] forKey:ZEGO_EFFECTS_DEVICE_LEVEL];
config.advancedConfig = [NSMutableDictionary dictionaryWithDictionary:mutableAdvancedConfig];
[ZegoEffects setAdvancedConfig:config];