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:
- You have integrated the ZegoEffects SDK and implemented basic image processing functionality. For details, see Implement basic image processing.
- You have imported the basic "CommonResources" resource files. For details, see Import resources and models.
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:
- Turn on 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.
Filters
-
Enable Filters.
Call the setFilter interface to enable/disable the filter feature, passing in the absolute path of the corresponding filter. Call the setFilterParam interface to set the intensity of the filter.
The "intensity" parameter of the ZegoEffectsFilterParam object, which represents the intensity of the filter, has a value range of [0, 100]. The higher the value, the greater the degree of effect presentation. Developers can customize the value according to their needs.
WarningThe effect of filter styles cannot be superimposed. After setting a new filter path, it will override the previous filter effect.
Untitled// Enable filter feature // 1. Enable filter feature, and pass in the absolute path of the corresponding filter mEffects.setFilter("/xxx/xxx/Night.bundle"); // Set filter intensity, range [0, 100] mEffects.setFilterParam({ intensity: 100 });
1 -
Remove Filter.
If you need to remove the filter, pass
null
into the setFilter interface.Untitled// Remove filter feature mEffects.setFilter(null);
1