Filters
The ZegoEffects SDK provides video filters with different styles that can be used in a wide range of use cases, such as live video streaming, short videos, and more.
Prerequisites
Before you begin to use the SDK's video filters in your project, make sure you complete the following steps:
- Integrate the ZegoEffects SDK into your project. For details, see Integration.
- Implement the basic image processing functionality. For details, see Implementation.
Implementation steps
The SDK provides video filters with the following styles:
- Natural: Creamy, Brighten, Fresh, Autumn
- Gray: Cool, Night, Film-like
- Dreamy: Sunset, Cozily, Sweet
In general, you can take the following steps to use a filter:
- Enable the filter by specifying the resource path of the filter.
- Set the filter parameters as needed. If not specified, the SDK uses the default settings.
Enable a filter
To enable a filter, do the following:
-
Call the setFilter method, passing the absolute path of the corresponding filter to the
path
parameter. -
Call the setFilterParam method to set the filter intensity.
The value range of the
intensity
property ofZegoEffectsFilterParam
is [0, 100]. As this value gets larger, the filter effect gets more intense.
You can't superimpose the effects of different filters. Once you apply a new filter, the previous one (if any) will be overridden.
// Enable a filter, passing in the absolute path of the corresponding filter.
mEffects.setFilter("/xxx/xxx/Night.bundle");
// Set the filter intensity. The value range is [0, 100].
ZegoEffectsFilterParam param = new ZegoEffectsFilterParam();
param.intensity = 100;
mEffects.setFilterParam(param);
Disable the filter
To disable the filter, call the setFilter
method with the path
parameter set to nil
.
If you need to remove the filter, you can pass null to the setFilter method.
// Disable the filter.
mEffects.setFilter(null);