Configuring the VideoFxProcessor object
The following tables list the VideoFxProcessor
properties that you can configure. The example below the tables shows a typical runtime configuration.
Background blur
Background blur takes the following properties:
Property |
Type |
Description |
---|---|---|
|
|
When |
|
|
Determines the extent of blurring. Valid values: |
Background replacement
Background replacement takes the following parameters:
Property |
Type |
Description |
---|---|---|
|
|
When |
|
|
The URL of the background image. The filter resizes the image dynamically to the dimensions of
the current screen. You can use a string such as |
|
|
A hex color string such as |
Changing a configuration at runtime
You can change a VideoFxProcessor
configuration at runtime by using the
videoFxProcessor.setEffectConfig
parameter. The following example shows how to enable
background replacement and disable background blur.
Note
You can only specify one type of background replacement at a time. Specify a value for backgroundImageURL
or defaultColor
, but not both.
videoFxConfig.backgroundBlur.isEnabled = false; videoFxConfig.backgroundReplacement.isEnabled = true; try { await videoFxProcessor.setEffectConfig(videoFxConfig); } catch(error) { logger.error(error.toString()) }
If setEffectConfig
throws an exception, the previous configuration remains in effect. setEffectConfig
throws exceptions under conditions similar to those that cause
VideoFxProcessor.create
to throw exceptions.
The following example shows how to change a background image while the video runs.
videoFxConfig.backgroundReplacement.backgroundImageURL = "https://
my-domain.com
/my-other-image.jpg
"; try { await videoFxProcessor.setEffectConfig(videoFxConfig); } catch(error) { logger.error(error.toString()) }